Basic
The Choicebox is an enhanced version of a Radio or Checkbox, offering users a larger tap target and additional details.
Preview
Code
Installation
CLI
Manual
npx hq-kit add choicebox
Single Selection
Although the Choicebox defaults to allowing multiple selections, it can be configured for single selection by setting the selectionMode
prop.
Preview
Code
Columns and Gap
The default layout for the Choicebox includes two columns with a 16px gap between items. These settings can be adjusted by passing the columns
and gap
props.
Preview
Code
Controlled
This component can function as either controlled or uncontrolled. For controlled use, provide the selectedKeys
prop and manage updates with the onSelectionChange
event handler.
Preview
Code
You have selected: sm
Disabled
Disable the entire Choicebox by applying the isDisabled
prop.
Preview
Code
Individual items can also be disabled by specifying their keys in the disabledKeys
prop.
<Choicebox disabledKeys={['sm', 'lg']} />