Skip to content

Commit

Permalink
Update switch docs
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Apr 11, 2024
1 parent a4d8254 commit b348275
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/data/base/components/switch/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ The Switch component provides users with a switch for toggling between two mutua
## Component

```jsx
import { Switch } from '@base_ui/react/Switch';
import * as Switch from '@base_ui/react/Switch';
```

### Anatomy

The Switch component is composed of a root that houses one interior slot—a thumb:

```tsx
<Switch>
<Switch.Root>
<Switch.Thumb />
</Switch>
</Switch.Root>
```

### Custom structure

Use the `render` prop to override the root or thumb component:

```jsx
<Switch render={(props) => <MyFancySwitchRoot {...props} />}>
<Switch.Root render={(props) => <MyFancySwitchRoot {...props} />}>
<Switch.Thumb render={(props) => <MyFancySwitchThumb {...props} />} />
</Switch>
</Switch.Root>
```

## Hook
Expand Down

0 comments on commit b348275

Please sign in to comment.