Buttons, Sliders, Date Pickers and Chips

Android Development 10 min min read Updated: Nov 16, 2026 Beginner
Buttons, Sliders, Date Pickers and Chips
Beginner Topic 6 of 9

Buttons

kotlin Button(onClick = { }) { Text("Filled") } FilledTonalButton(onClick = { }) { Text("Tonal") } OutlinedButton(onClick = { }) { Text("Outlined") } TextButton(onClick = { }) { Text("Text") } Button(onClick = { }) { Icon(Icons.Default.Add, contentDescription = null) Spacer(Modifier.width(8.dp)) Text("Add item") } IconButton(onClick = { }) { Icon(Icons.Default.Settings, contentDescription = "Settings") } FloatingActionButton(onClick = { }) { Icon(Icons.Default.Add, contentDescription = "Add") } ExtendedFloatingActionButton(onClick = { }, icon = { Icon(Icons.Default.Edit, null) }, text = { Text("Compose") })

Slider

kotlin var volume by remember { mutableFloatStateOf(0.5f) } Column { Text("Volume: ${(volume * 100).toInt()}%") Slider(value = volume, onValueChange = { volume = it }, valueRange = 0f..1f, steps = 9) }

Chips and Segmented Buttons

kotlin var selected by remember { mutableStateOf(setOf("Kotlin")) } FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) { listOf("Kotlin", "Java", "Compose", "XML").forEach { tag -> FilterChip( selected = tag in selected, onClick = { selected = if (tag in selected) selected - tag else selected + tag }, label = { Text(tag) } ) } } var index by remember { mutableIntStateOf(0) } SingleChoiceSegmentedButtonRow { listOf("Day", "Week", "Month").forEachIndexed { i, label -> SegmentedButton( selected = index == i, onClick = { index = i }, shape = SegmentedButtonDefaults.itemShape(i, 3) ) { Text(label) } } }

Date Picker

kotlin @OptIn(ExperimentalMaterial3Api::class) @Composable fun DateField() { var show by remember { mutableStateOf(false) } val state = rememberDatePickerState() val date = state.selectedDateMillis?.let { java.text.SimpleDateFormat("dd MMM yyyy", java.util.Locale.getDefault()).format(java.util.Date(it)) } ?: "Pick a date" OutlinedButton(onClick = { show = true }) { Text(date) } if (show) { DatePickerDialog( onDismissRequest = { show = false }, confirmButton = { TextButton(onClick = { show = false }) { Text("OK") } }, dismissButton = { TextButton(onClick = { show = false }) { Text("Cancel") } } ) { DatePicker(state = state) } } }

Time Picker

kotlin val timeState = rememberTimePickerState(is24Hour = false) TimePicker(state = timeState) Text("Selected ${timeState.hour}:${"%02d".format(timeState.minute)}")
Experimental APIs: Some Material 3 components are marked @OptIn(ExperimentalMaterial3Api::class). They are safe to use, but their names may change in future library versions.
Touch size: Keep tap targets at least 48 x 48 dp. Material buttons already follow this rule.

Conclusion

Material 3 gives you ready-made buttons, sliders, chips and pickers. Use filled buttons for the main action and text buttons for the minor ones.

Quick Summary: Button, OutlinedButton, TextButton, FAB, Slider, FilterChip, SegmentedButton, DatePicker and TimePicker cover most actions.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators