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

Choicebox

choicebox

Selects one rich option from cards containing titles, descriptions, and supporting content.

Usage

Basic radio selection

Card-based single selection, for uncontrolled use defaultValue; each item can have an icon/title/description/additional content.

tsx
<ChoiceboxGroup defaultValue="pro" aria-label="Subscription Package" className="w-80">
  <Choicebox value="free" icon={<Zap />} title="Basic version" description="Personal project · Free forever">
    <div className="mt-1 font-semibold">¥0</div>
  </Choicebox>
  <Choicebox value="pro" icon={<Rocket />} title="Professional Edition" description="Small Team · Includes All Components">
    <div className="mt-1 font-semibold">¥39/month</div>
  </Choicebox>
</ChoiceboxGroup>

Multiple selection + disabled items

multiple switches to multi-select semantics; single-item disabled locks the card.

tsx
<ChoiceboxGroup multiple defaultValue={["card"]} columns={1} aria-label="Payment method" className="w-72">
  <Choicebox value="card" icon={<CreditCard />} title="Bank Card" description="Debit Card/Credit Card" />
  <Choicebox value="wallet" icon={<Wallet />} title="Electronic Wallet" description="WeChat/Alipay" />
  <Choicebox value="cash" icon={<Banknote />} title="Cash on delivery" disabled description="This region is not supported yet" />
</ChoiceboxGroup>

Two column grid

columns Controls the number of grid columns, suitable for compact options without icons.

tsx
<ChoiceboxGroup defaultValue="b" columns={2} aria-label="Theme" className="w-[28rem]">
  <Choicebox value="a" title="Light color" description="Bright interface" />
  <Choicebox value="b" title="Dark" description="Dark interface" />
  <Choicebox value="c" title="Follow the system" description="Automatic switching" />
  <Choicebox value="d" title="High contrast" description="Barrier-free" />
</ChoiceboxGroup>

When to use

Use Choicebox when each option needs a card with a title, description, and icon, such as a subscription plan, payment method, or theme level. Use ordinary Radio or Checkbox for a single line of text, or ColorSwatchPicker for color swatches.

Import

ts
import { ChoiceboxGroup, Choicebox } from "@hulianui/ui"

Props

ChoiceboxGroup

NameTypeDefaultDescription
valuestring | string[]-Controlled value: string for single selection and string[] for multiple selection.
defaultValuestring | string[]-Initial value when uncontrolled.
multiplebooleanfalseEnables checkbox-style multiple selection; otherwise the group uses radio semantics.
namestringAutomatically generatedRadio-group name in single-select mode.
columnsnumber1Number of grid columns
disabledbooleanfalseDisables the entire group.
classNamestring-Additional class name for the container.
aria-labelstring-Accessible label.

Choicebox

NameTypeDefaultDescription
value*string-Option value, unique within the group.
disabledbooleanfalseDisables this option.
classNamestring-Additional class name for the card.

Events

ChoiceboxGroup

EventTypeDescription
onValueChange(value: string | string[]) => voidCalled with a string in single-select mode or string[] in multiple-select mode.

Slots

ChoiceboxGroup

SlotTypeDescription
childrenReactNodeA set of Choicebox options.

Choicebox

SlotTypeDescription
titleReactNodePrimary title.
descriptionReactNodeSupporting description.
iconReactNodeLeading icon.
childrenReactNodeAdditional content beyond the title/description (price, tags, etc.)

Usage guidelines

  • Keep the value and defaultValue type aligned with multiple: use string for single selection and string[] for multiple selection. Mixing them produces inconsistent selection state.
  • Interactive controls inside Choicebox children, such as delete or action buttons, conflict with the card-wide selection target. Stop event propagation from the nested control, or position it outside the radio/checkbox hit area.

Related

SecretField · Combobox · Listbox · Mentions · InputOTP · Rating

Playground

<ChoiceboxGroup defaultValue="a">
  <Choicebox value="a" title="Option A" description="..." />
  <Choicebox value="b" title="Option B" description="..." />
</ChoiceboxGroup>
PreviousColorSwatchPickerFormsNextEmojiPicker

On this page

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