v2.1.8
/
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Layout
  • App
  • Container
  • Error
  • SidebarLayout
  • Element
  • Advice
  • Alert
  • Avatar
  • AvatarGroup
  • Badge
  • Banner
  • Button
  • Calendar
  • Card
  • Chip
  • Collapsible
  • Countdown
  • FieldGroup
  • Kbd
  • Progress
  • Separator
  • Skeleton
  • Form
  • Checkbox
  • CheckboxGroup
  • ColorPicker
  • FileUpload
  • Form
  • FormField
  • Input
  • InputDate
  • InputMenu
  • InputNumber
  • InputTags
  • InputTime
  • PinInput
  • RadioGroup
  • Range
  • Select
  • SelectMenu
  • Switch
  • Textarea
  • Data
  • Accordion
  • DescriptionList
  • Empty
  • Table
  • TableWrapper
  • Timeline
  • User
  • Navigation
  • Breadcrumb
  • CommandPalette
  • Link
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Overlay
  • ContextMenu
  • DropdownMenu
  • Modal
  • Popover
  • Slideover
  • Toast
  • Tooltip
  • Page
  • PageCard
  • PageColumns
  • PageGrid
  • PageLinks
  • PageList
  • Dashboard
  • DashboardGroup
  • DashboardSearch
  • DashboardSearchButton
  • AI Chat
  • soonChatMessage
  • soonChatMessages
  • soonChatPalette
  • soonChatPrompt
  • soonChatPromptSubmit
  • Content
  • ContentSearch
  • ContentSearchButton
  • ContentSurround
  • ContentToc
  • Color Mode
  • ColorModeAvatar
  • ColorModeButton
  • ColorModeImage
  • ColorModeSelect
  • ColorModeSwitch
  • i18n
  • LocaleSelect
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.8
  • Docs
  • Components
  • Composables
  • Typography

ColorPicker

A color picker component.
GitHub
Demo
Nuxt UI

Usage

Use the v-model directive to control the value of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

Use the default-value prop to set the initial value when you do not need to control its state.

{
  "wait": "Loading client-side content..."
}

RGB Format

Use the format prop to set rgb value of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

HSL Format

Use the format prop to set hsl value of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

CMYK Format

Use the format prop to set cmyk value of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

CIELab Format

Use the format prop to set lab value of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

Throttle

Use the throttle prop to set the throttle value of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

Size

Use the size prop to set the size of the ColorPicker.

{
  "wait": "Loading client-side content..."
}

Disabled

Use the disabled prop to disable the ColorPicker.

{
  "wait": "Loading client-side content..."
}

Examples

As a Color chooser

Use a Button and a Popover component to create a color chooser.

{
  "wait": "Loading client-side content..."
}

API

Props

Prop Default Type
as'div'any

The element or component this component should render as.

throttle50 number

Throttle time in ms for the color picker

disabledboolean

Disable the color picker

defaultValue'#FFFFFF' string

The default value of the color picker

format'hex' "hex" | "rgb" | "hsl" | "cmyk" | "lab"

Format of the color

size'md' "xs" | "sm" | "md" | "lg"
modelValue string
b24ui { root?: ClassNameValue; picker?: ClassNameValue; selector?: ClassNameValue; selectorBackground?: ClassNameValue; selectorThumb?: ClassNameValue; track?: ClassNameValue; trackThumb?: ClassNameValue; }

Emits

Event Type
update:modelValue[value: string | undefined]

Theme

app.config.ts
export default defineAppConfig({
  b24ui: {
    colorPicker: {
      slots: {
        root: 'data-[disabled]:opacity-30',
        picker: 'flex gap-4',
        selector: 'rounded-(--ui-border-radius-md) touch-none',
        selectorBackground: 'w-full h-full relative rounded-(--ui-border-radius-md)',
        selectorThumb: '-translate-y-1/2 -translate-x-1/2 absolute size-4 ring-2 ring-(--ui-color-base-white-fixed) rounded-full cursor-pointer data-[disabled]:cursor-not-allowed',
        track: 'w-[8px] relative rounded-(--ui-border-radius-md) touch-none',
        trackThumb: 'absolute transform -translate-y-1/2 -translate-x-[4px] rtl:translate-x-[4px] size-4 rounded-full ring-2 ring-(--ui-color-base-white-fixed) cursor-pointer data-[disabled]:cursor-not-allowed'
      },
      variants: {
        size: {
          xs: {
            selector: 'w-[152px] h-[152px]',
            track: 'h-[152px]'
          },
          sm: {
            selector: 'w-[160px] h-[160px]',
            track: 'h-[160px]'
          },
          md: {
            selector: 'w-[168px] h-[168px]',
            track: 'h-[168px]'
          },
          lg: {
            selector: 'w-[176px] h-[176px]',
            track: 'h-[176px]'
          }
        }
      },
      compoundVariants: [],
      defaultVariants: {
        size: 'md'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'

export default defineConfig({
  plugins: [
    vue(),
    bitrix24UIPluginVite({
      b24ui: {
        colorPicker: {
          slots: {
            root: 'data-[disabled]:opacity-30',
            picker: 'flex gap-4',
            selector: 'rounded-(--ui-border-radius-md) touch-none',
            selectorBackground: 'w-full h-full relative rounded-(--ui-border-radius-md)',
            selectorThumb: '-translate-y-1/2 -translate-x-1/2 absolute size-4 ring-2 ring-(--ui-color-base-white-fixed) rounded-full cursor-pointer data-[disabled]:cursor-not-allowed',
            track: 'w-[8px] relative rounded-(--ui-border-radius-md) touch-none',
            trackThumb: 'absolute transform -translate-y-1/2 -translate-x-[4px] rtl:translate-x-[4px] size-4 rounded-full ring-2 ring-(--ui-color-base-white-fixed) cursor-pointer data-[disabled]:cursor-not-allowed'
          },
          variants: {
            size: {
              xs: {
                selector: 'w-[152px] h-[152px]',
                track: 'h-[152px]'
              },
              sm: {
                selector: 'w-[160px] h-[160px]',
                track: 'h-[160px]'
              },
              md: {
                selector: 'w-[168px] h-[168px]',
                track: 'h-[168px]'
              },
              lg: {
                selector: 'w-[176px] h-[176px]',
                track: 'h-[176px]'
              }
            }
          },
          compoundVariants: [],
          defaultVariants: {
            size: 'md'
          }
        }
      }
    })
  ]
})

CheckboxGroup

Multi-select checklist using button controls.

FileUpload

A file upload input component.

On this page

  • Usage
    • RGB Format
    • HSL Format
    • CMYK Format
    • CIELab Format
    • Throttle
    • Size
    • Disabled
  • Examples
    • As a Color chooser
  • API
    • Props
    • Emits
  • Theme
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24