# Color picker (UI SDK): Form

> A hidden input submits the value under `name`, and a form reset goes back to `defaultValue`.

Canonical: https://hextaui.com/docs/ui-sdk-color-picker/examples/form

Component docs: https://hextaui.com/docs/ui-sdk-color-picker

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/ui-sdk-color-picker-form.json
```

This adds `components/examples/ui-sdk-color-picker/form.tsx` with the Color picker component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/ui-sdk-color-picker/form.tsx"
"use client"

import * as React from "react"

import { Button } from "@/components/ui/button"
import {
  ColorPicker,
  ColorPickerArea,
  ColorPickerSlider,
  ColorPickerSwatch,
} from "@/components/ui/ui-sdk-color-picker"

function UiSdkColorPickerForm() {
  const [submitted, setSubmitted] = React.useState<string | null>(null)

  return (
    <form
      className="flex w-full max-w-64 flex-col gap-3"
      onSubmit={(event) => {
        event.preventDefault()
        setSubmitted(String(new FormData(event.currentTarget).get("brand")))
      }}
      onReset={() => setSubmitted(null)}
    >
      <ColorPicker aria-label="Brand color" name="brand" defaultValue="#f97316">
        <ColorPickerArea />
        <div className="flex items-center gap-2">
          <ColorPickerSwatch />
          <div className="min-w-0 flex-1">
            <ColorPickerSlider channel="hue" />
          </div>
        </div>
      </ColorPicker>
      <div className="flex gap-2">
        <Button type="submit" size="sm">
          Save
        </Button>
        <Button type="reset" variant="outline" size="sm">
          Reset
        </Button>
      </div>
      <p role="status" className="text-sm text-muted-foreground">
        {submitted ? (
          <>
            Submitted brand=
            <span className="font-mono text-foreground">{submitted}</span>
          </>
        ) : (
          "Nothing submitted yet."
        )}
      </p>
    </form>
  )
}

export { UiSdkColorPickerForm }
```

## Props in this example

### ColorPicker

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `string` | `"black"` |  |
| `name` | `string` | – |  |

### ColorPickerSlider

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `channel` | `ColorChannel` | – | Hue, or blue in sRGB, by default. |

## More Color picker examples

- [Inline](https://hextaui.com/docs/ui-sdk-color-picker/examples/inline)
- [Alpha](https://hextaui.com/docs/ui-sdk-color-picker/examples/alpha)
- [OKLCH](https://hextaui.com/docs/ui-sdk-color-picker/examples/oklch)
- [Presets and channels](https://hextaui.com/docs/ui-sdk-color-picker/examples/channels)
- [Vertical sliders](https://hextaui.com/docs/ui-sdk-color-picker/examples/vertical)
- [Controlled](https://hextaui.com/docs/ui-sdk-color-picker/examples/controlled)
- [Disabled](https://hextaui.com/docs/ui-sdk-color-picker/examples/disabled)
- [Read-only](https://hextaui.com/docs/ui-sdk-color-picker/examples/read-only)
- [Right to left](https://hextaui.com/docs/ui-sdk-color-picker/examples/rtl)
