# With label

> Switch paired with an accessible field label.

A shadcn/ui block from the [@flx](https://ui.flexnative.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/flx/switch-02).

- Page, with a live preview: https://shadcn.exchange/r/flx/switch-02
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/flx/switch-02-light-853e9f5e1815d5ab.png
- Registry item: https://ui.flexnative.com/r/switch-02.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.flexnative.com/r/switch-02.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `switch`, `field`

## Files

### `registry/patterns/switch/switch-02.tsx`

```tsx
import { Field, FieldLabel } from '@/components/ui/field'
import { Switch } from '@/components/ui/switch'

export function Switch02() {
  return (
    <Field orientation="horizontal" className="w-full max-w-sm">
      <FieldLabel htmlFor="switch-02">Airplane mode</FieldLabel>
      <Switch id="switch-02" />
    </Field>
  )
}
```
