Color Area Controlled

PreviousNext

color-area-controlled-demo

Docs
intentuipage

Preview

Loading preview…
components/docs/colors/color-area/color-area-controlled-demo.tsx
"use client"

import { parseColor } from "@react-stately/color"
import { useState } from "react"
import { ControlledValues } from "@/components/docs/colors/controlled-values"
import { ColorArea } from "@/components/ui/color-area"
import { ColorThumb } from "@/components/ui/color-thumb"

export default function ColorAreaControlledDemo() {
  const [value, setValue] = useState(parseColor("hsl(0, 100%, 50%)"))

  return (
    <div className="flex flex-col gap-2 lg:flex-row lg:gap-4">
      <ColorArea value={value} onChange={setValue}>
        <ColorThumb />
      </ColorArea>
      <ControlledValues color={value} />
    </div>
  )
}

Installation

npx shadcn@latest add @intentui/color-area-controlled-demo

Usage

Usage varies by registry entry. Refer to the registry docs or source files below for details.