Skip to content

[Switch] Implement new API #4

@colmtuite

Description

@colmtuite

Anatomy

// JSX
<Switch required>
  <Switch.Thumb />
</Switch>

// Rendered HTML
<button type="button" role="switch" aria-checked="false" data-state="unchecked" data-required>
  <span data-state="unchecked" data-required />
</button>
<input type="checkbox" aria-hidden="true" tabindex="-1" style="hide visually" required />

Components

Root

Rendered element: button

prop type default
required boolean false
disabled boolean false
autoFocus boolean false
readOnly boolean false
name string
checked boolean
defaultChecked boolean
onChange (event: ChangeEvent) ⇒ void

Thumb

Rendered element: span

prop type type
render (props, state) ⇒ ReactElement
className

State Object

  • required
  • disabled
  • readOnly
  • checked

Metadata

Metadata

Assignees

Labels

component: switchChanges related to the switch component.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

Status

Recently completed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions