Concepts
OverviewCompositionTestingLayout
Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrapComponents
AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltipUtilities
Feature FlagsForLocal StoragePortalShowsplitPropsThemeSelect
The Select component is a controlled component that can be used to select one option from a set. It can be used in a group with other selects to allow for multiple selections.
import { Select, Option, OptionGroup, OptionGroupLabel, createSelectCollection} from '@cerberus/react'Usage
The Select component is a controlled component that can be used to select one option from a set. It can be used in a group with other selects to allow for multiple selections.
Grouped Options
To group options, use the OptionGroup and OptionGroupLabel components.
With Dialog
To use the Select component with a dialog, you can use the container prop to render the dropdown in the dialog dom-tree.
Some heading
Primitives
You can utilize the primitive components or the css prop to customize the select.
| Component | Description |
|---|---|
| SelectRoot | The context provider for the Select family |
| SelectLabel | The label that appears above the select input |
| SelectControl | The wrapper to the select trigger that opens the dropdown |
| SelectTrigger | he trigger that opens the dropdown |
| SelectValueText | The text that appears in the trigger |
| SelectIndicator | The indicator that appears in the trigger |
| SelectClearTrigger | The trigger that clears the selected value |
| SelectPositioner | The wrapper that positions the dropdown |
| SelectContent | The content of the dropdown (i.e. the container itself) |
| SelectItemGroup | The group of options in the dropdown |
| SelectItemGroupLabel | The label for the group of options |
| SelectItem | The option in the dropdown |
| SelectItemText | The text label of the option |
| SelectItemIndicator | The indicator shown when the option is selected |
| SelectHiddenInput | The native select for the select group. |
API
Select
The Select component is an abstraction of our primitives and accepts the following props:
| Name | Default | Description |
|---|---|---|
| placeholder | The placeholder to show in the select trigger. | |
| size | 'md' | The size of the select. |
| collection | The collection of options to show in the dropdown. | |
| container | The container to render the dropdown in. If not provided, it will use the body component. |
The Select component also accepts all the props of the SelectRoot primitive props
Option
The Option component is an abstraction of our primitives and accepts the following props:
| Name | Default | Description |
|---|---|---|
| item | The item to show in the dropdown. SelectCollectionItem |
The Option component also accepts all the props of the SelectItem primitive props
OptionGroup
The OptionGroup component is an abstraction of our primitives and accepts the same props as the SelectItemGroup primitive.
OptionGroupLabel
The OptionGroupLabel component is an abstraction of our primitives and accepts the same props as the SelectItemGroupLabel primitive.
createSelectCollection
The createSelectCollection function is a utility function that creates a collection of options for the Select component.
export function createSelectCollection( collection: SelectCollectionItem[],): ListCollection<SelectCollectionItem> { return createListCollection({ items: collection, })}Parts
The SelectParts API is an Object containing the full family of components.
| Name | Description |
|---|---|
| Root | The SelectRoot component which is the Provider for the family. |
| Label | The SelectLabel component which displays the label and "required" notice. |
| Control | The SelectControl component which is the visual field. |
| Trigger | The SelectTrigger component which is the trigger for the dropdown. |
| ClearTrigger | The SelectClearTrigger component which is the trigger to clear the selected value. |
| ValueText | The SelectValueText component which displays the selected value. |
| Indicator | The SelectIndicator component which displays the trigger indicator. |
| Positioner | The SelectPositioner component which is controls the positioning for the dropdown. |
| Content | The SelectContent component which is the dropdown itself. |
| ItemGroup | The SelectItemGroup component which is the group of options in the dropdown. |
| ItemGroupLabel | The SelectItemGroupLabel component which is the label for the group of options. |
| Item | The SelectItem component which is the option in the dropdown. |
| ItemText | The SelectItemText component which is the text label of the option. |
| ItemIndicator | The SelectItemIndicator component which displays based on the checked state. |
| HiddenInput | The SelectHiddenInput component which displays the native input. |
On this page