Lynx

Checkbox

A component that allows users to select one or more options. It is used for selecting multiple items in a list or for optional actions such as terms and conditions agreement.

Engine ≥ 3.6
Available since@seed-design/lynx-react@0.1.0, @seed-design/lynx-css@0.1.0
Loading Lynx example…

Icon colors are not applied in the document preview. You can check the actual icon colors by running Lynx Explorer in the QR code tab.

Installation

npx @seed-design/cli@latest add ui:checkbox

Props

CheckboxGroup

Prop

Type

label?React.ReactNode
indicator?React.ReactNode
showRequiredIndicator?boolean | undefined
description?React.ReactNode
errorMessage?React.ReactNode
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined
required?boolean | undefined
readOnly?boolean | undefined

Checkbox

Prop

Type

label?React.ReactNode
checked?boolean | undefined
defaultChecked?boolean | undefined
indeterminate?boolean | undefined
onCheckedChange?((checked: boolean) => void) | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

Checkmark

Prop

Type

className?string | undefined
style?CSSProperties | undefined
checked?boolean | undefined
indeterminate?boolean | undefined
defaultChecked?boolean | undefined
onCheckedChange?((checked: boolean) => void) | undefined

Accessibility Name

Checkbox.Root is exposed as an accessibility element by default. It also passes the checkbox role and the current checked state and disabled state. When you pass a string label to Registry Checkbox, the screen text is also connected to accessibility-label. When composing text with a non-string label or children, pass the same content directly to accessibility-label.

Examples

Sizes

Loading Lynx example…

Tones and Variants

Brand

Loading Lynx example…

Neutral

Loading Lynx example…

Indeterminate

Loading Lynx example…

Weights

Loading Lynx example…

Long Label

Loading Lynx example…

Disabled

Loading Lynx example…

Listening to Value Changes

You can detect checkbox state changes with onCheckedChange.

Loading Lynx example…

Use Cases

Using Checkmark

Lynx Registry's Checkmark includes its own Checkbox.Root. When used standalone, pass accessibility-label. To put the text in the same tap area, use children of Registry Checkbox. In this case, also pass accessibility-label directly.

Loading Lynx example…

Fieldset Integration

You can use CheckboxGroup to group multiple checkboxes and use Fieldset-related props such as label, description, and errorMessage.

Loading Lynx example…

Differences from Web Version

Lynx Checkbox has the following differences from React Checkbox:

  • Icon injection method: The Checkbox and Checkmark in the snippet automatically inject check / minus icons from @karrotmarket/lynx-monochrome-icon. When directly composing the compound component, you must pass a Lynx monochrome icon to Checkbox.Indicator. Raw <svg> injection is outside the Lynx scope.
  • Error guidance rendering: React keeps description in the accessibility tree when an error is displayed, but Lynx has no visually hidden processing method in the DOM, so it renders only errorMessage and excludes description from both the screen and accessibility tree.
  • Event handling: Only onCheckedChange is exposed instead of onChange. The tap handler is owned inside Root.
  • Pressed state: The internal press state is passed as a pressed boolean variant of the checkmark recipe instead of web's data-active.
  • Scale Feedback: Lynx expresses the pressed state with color and does not provide React's --seed-checkmark-feedback-scale CSS variable.
  • Accessibility attributes: Native <view> / <text> elements are rendered instead of HTML <label> / <input>. Checkbox.Root passes role and checked state with accessibility-element, accessibility-role-description, and accessibility-value.
  • Compound structure: The composition of Checkbox.Root → Checkbox.Control → Checkbox.Indicator + Checkbox.Label and the flow of sharing state and variant through Context are the same.
  • ref forwarding: Checkbox, Checkmark, and CheckboxGroup forward refs to the Root view. They do not provide a hidden input ref like the web snippet.

Lynx Unsupported Features

The following features are currently not supported due to Lynx platform constraints.

Excluded due to Runtime Model Difference

FeatureWeb EquivalentDescription
CheckboxHiddenInput<input type="checkbox">No HTML form submission model in Lynx
inputPropshidden input propsLynx snippet does not render hidden input
Individual Checkbox name / value / required / invalidform field propsNo native form submission model in Lynx
React Hook Form exampleHTML form and hidden input integrationMust directly connect app state with checked / onCheckedChange
focus / focusVisibleKeyboard focusNo keyboard focus concept in Lynx
onChange (raw DOM event)React.ChangeEventNot applicable. Replaced with onCheckedChange
weight="default" / "stronger"deprecated compatibility mappingLynx only exposes "regular" / "bold"

Table of contents