Lynx

Chip

A component that displays a short value that users can select or execute.

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

Installation

npm install @seed-design/lynx-react @seed-design/lynx-css

Lynx Chip is provided directly from the @seed-design/lynx-react package without a separate ui:chip snippet.

Props

Chip.Button

Prop

Type

style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined

Chip.Toggle

Prop

Type

checked?boolean | undefined
defaultChecked?boolean | undefined
onCheckedChange?((checked: boolean) => void) | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined

Chip.RadioRoot

Prop

Type

value?string | undefined
defaultValue?string | undefined
disabled?boolean | undefined
onValueChange?((value: string) => void) | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

Chip.RadioItem

Prop

Type

valuestring
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined

Slots

Prop

Type

style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

Examples

Sizes

Small

Loading Lynx example…

Medium

Loading Lynx example…

Large

Loading Lynx example…

Variants

Solid

Loading Lynx example…

Outline Strong

Loading Lynx example…

Outline Weak

Loading Lynx example…

Prefix Icon

Loading Lynx example…

Suffix Icon

Loading Lynx example…

Icon Only

With layout="iconOnly", pass both Icon as a child and accessibility-label.

Loading Lynx example…

Prefix Avatar

The Lynx package does not provide an Avatar component. Use the Chip.PrefixAvatar slot by putting your app's own avatar component or view inside it. The initial circle in the example below is not an Avatar implementation including image loading and fallback, but only shows how to combine slots.

Loading Lynx example…

Listening to Value Changes

  • Chip.Toggle
    • You can detect toggle state changes with onCheckedChange.
  • Chip.RadioRoot / Chip.RadioItem
    • You can detect radio button value changes with onValueChange of Chip.RadioRoot.
Loading Lynx example…

Differences from Web Version

Lynx Chip uses the same Button, Toggle, Radio composition and size/variant names as React Chip, but has the following differences:

  • Rendering elements: Native <view> / <text> are rendered instead of HTML <button> / <label> / <input>.
  • Event handling: bindtap is used instead of onClick, and onCheckedChange or onValueChange is used instead of onChange.
  • State styling: Instead of web pseudo selectors, touch state and selected state are connected to the pressed and selected variants of the Lynx recipe.
  • Icon rendering: Lynx monochrome icon and <image tint-color>-based Icon wrapper are used instead of SVG currentColor.
  • Accessibility role and state: Chip.Button, Chip.Toggle, and Chip.RadioItem pass their respective button, toggle, and radio roles via accessibility-role-description. Toggle's checked state and RadioItem's selected state are passed via accessibility-value, and disabled state is passed via accessibility-traits. You can override each property directly if needed.
  • Public surface: The Lynx package API directly provides the role of React's registry wrapper, so no separate snippet installation is needed.

Lynx Unsupported Features

The following features are not supported due to differences in the current Lynx implementation and runtime model.

FeatureDescription
HiddenInput / inputPropsLynx has no HTML input and form submission model.
name / required / native form valueThere is no target to connect HTML form attributes.
raw DOM onChangeReplaced with onCheckedChange or onValueChange.
Keyboard focus / focusVisibleLynx has no keyboard focus model like the web.
asChildLynx does not support web Slot-based polymorphic rendering.
Avatar packageUse by putting your app's own avatar view or component in the Chip.PrefixAvatar slot.

Table of contents