Skip to main content
Give us your valuable feedback

It will help us understand how we can serve you better

Give feedback

Components

Checkbox

Allow users to select and deselect items in bulk

banner-Checkbox
Component Status Details

Status component contains a list of checks and completeness that has been tested and owned by each component

check-list-icon We don't use color as the only visual tool to convey information.
check-list-icon The component’s structure and properties include relevant options such as variant, style, size, orientation, optional iconography, decorations, selection, error state, etc.check-list-icon The title is the component name that uses the frame base component template.check-list-icon The base component name contains: .Base & "Component Name" if there is more than one.check-list-icon All component properties use the Legion foundation.
check-list-icon We can change all the parts that are connected to the component base.check-list-icon The inside of the base component remains connected to the master component.check-list-icon All variant options are not damaged when we change from one to another.check-list-icon Overriding changes to components will not reset other variants.
check-list-icon Component's already has component specs documentation.

Status

Resources

Checkboxes allow users to select one or more items from a set. Checkboxes can turn an option on or off.

Usage

The following is how to implement Checkbox component in Legion :

Single

The basic checkbox component is used for individual checkboxes or basic checkbox needs.

var checkedState by remember { mutableStateOf(false) }
LgnCheckbox(
checked = checkedState,
onCheckedChange = {
checkedState = it
},
label = "Checkbox Label",
enabled = true,

Single Checkbox Attributes

ParameterDescriptionType
checkedWhether or not this checkbox is checked.Boolean
onCheckedChangeCalled when this checkbox is clicked. If null, then this checkbox will not be interactable, unless something else handles its input events and updates its state.((Boolean) -> Unit)?
modifierThe Modifier to be applied to the checkbox.Modifier
labelText label for this checkbox.String?
enabledControls the enabled state of this checkbox. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.Boolean
colorsLgnCheckboxColors that will be used to resolve the colors used for this checkbox in different states. See LgnCheckboxDefaults.colors.LgnCheckboxColors
sizeThe size to be applied to the checkbox.LgnCheckboxSize
interactionSourceThe source of the interactions for the checkbox.MutableInteractionSource

Group

Components for grouping checkboxes, to make it easier if you need checkbox options on your form.

var checkedGroup by remember {
mutableStateOf(mutableListOf<Int>())
}
val optionCheckboxGroup = listOf(
LgnCheckboxItemData(
id = 1,
label = "Checkbox 1"
),

Checkbox Group Attributes

ParameterDescriptionType
dataList of LgnCheckboxItem data to provide options in LgnCheckboxGroup.List<T>
checkedIdsList of LgnCheckboxItem.id to provide checked items in LgnCheckboxGroup.List<Int>
onCheckedItemCalled when this checkbox item is clicked. If null, then this checkbox will not be interactable, unless something else handles its input events and updates its state.((item: T) -> Unit)?
modifierThe Modifier to be applied to the checkbox group.Modifier
spacedBetweenItemTo define spacing between checkbox items.Dp