Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Buttons

  • Button
  • ShimmerButton
  • InteractiveHoverButton
  • RainbowButton
  • PulsatingButton
  • RippleButton
  • ButtonGroup
  • SocialButton

Basic Inputs

  • Input
  • Textarea
  • CellEditor
  • Select
  • Checkbox
  • CheckboxGroup
  • Radio
  • Switch
  • Toggle
  • Segmented
  • Slider
  • NumberField
  • ElasticSlider

Advanced Inputs

  • MathTextarea
  • QuestionEditor
  • QuestionAnswer
  • MathField
  • SecretField
  • PasswordGenerator
  • Combobox
  • RemoteSelect
  • Listbox
  • Mentions
  • InputOTP
  • Rating
  • Upload
  • RegionSelect
  • ImageCropper
  • ScopeMatrix
  • Transfer
  • Cascader
  • TreeSelect
  • RegionCascader
  • CountrySelect
  • MarkdownEditor
  • Novel editor
  • RichTextEditor
  • CodeEditor
  • IssueReporter
  • ColorPicker
  • ColorField
  • ColorSwatchPicker
  • Choicebox
  • EmojiPicker
  • VoiceRecord
  • IconPicker
  • InspectorPanel

Date and Time

  • Calendar
  • DatePicker
  • DateTimePicker
  • DateRangePicker
  • TimePicker
  • TimeField

Form Frameworks

  • Form
  • ModalForm / DrawerForm
  • ProForm
  • StepsForm
  • LoginForm
  • AuthPanel
  • ClickCaptcha
  • Label
  • Field
  • SearchForm

CheckboxGroup

checkbox-group

Coordinates an array of values across a group of checkboxes.

Usage

Basic usage

The child is Hulian Checkbox (each with value), and the group matches members by value.

tsx
<CheckboxGroup defaultValue={["apple"]}>
  <Checkbox value="apple" label="Apple" />
  <Checkbox value="banana" label="Banana" />
  <Checkbox value="cherry" label="Cherry" />
</CheckboxGroup>

Horizontal arrangement

orientation=horizontal horizontally and automatically wrap.

tsx
<CheckboxGroup defaultValue={["apple"]} orientation="horizontal">
  <Checkbox value="apple" label="Apple" />
  <Checkbox value="banana" label="Banana" />
  <Checkbox value="cherry" label="Cherry" />
</CheckboxGroup>

Disable the entire group

disabled is delivered to all Checkbox in the group.

tsx
<CheckboxGroup defaultValue={["banana"]} disabled>
  <Checkbox value="apple" label="Apple" />
  <Checkbox value="banana" label="Banana" />
</CheckboxGroup>

When to use

Use CheckboxGroup when related checkboxes should share a value array, such as multi-select filters or interest tags. Use Checkbox for one independent Boolean choice, Radio for mutually exclusive options, or Select for dropdown multi-selection. Children are HulianUI Checkbox components with a value; the group matches members by that value.

Import

ts
import { CheckboxGroup } from "@hulianui/ui"

Props

NameTypeDefaultDescription
valuestring[]-Controlled array of checked values.
defaultValuestring[]-Initial checked values when uncontrolled.
disabledbooleanfalseDisables every checkbox in the group.
orientation"vertical" | "horizontal""vertical"Layout direction.
classNamestring-Additional class name for the root element.
aria-labelstring-Accessible label for the group.

Events

EventTypeDescription
onValueChange(value: string[]) => voidCalled when the checked values change.

Slots

SlotTypeDescription
childrenReactNodeHulianUI Checkbox children, each with a value.

Usage guidelines

  • Every child Checkbox must provide value, not name. See [[base-ui-checkbox-group-matches-members-by-value-not-name]]: Base UI rc.0 matches group members by each child's value. Using name makes defaultValue, value, and onValueChange fail silently even though the boxes still render.
  • Inside a Field, each child Checkbox is named by its own label; the Field label names the group (role=group), and description / error still reach every item. No need to wrap items in Base UI Field.Item yourself.

Related

Input · Textarea · Select · Checkbox · Radio · Switch

Playground

<CheckboxGroup defaultValue={["apple"]}>
  <Checkbox value="apple" label="Apple" />
  <Checkbox value="banana" label="Banana" />
</CheckboxGroup>
PreviousCheckboxFormsNextRadio

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Usage guidelines
    • Related
  • Playground