logoNamu Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
1.0.0
  • Components Overview
  • General
    • Button
    • FloatButtonNew
    • Icon
    • Typography
  • Layout
    • Divider
    • Grid
    • Layout
    • Space
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPickerNew
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCodeNew
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • TourNew
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • AppNew
    • ConfigProvider
When To Use
Examples
Basic Usage
Trigger size
controlled mode
Color change completed
Rendering Trigger Text
Disable
Disabled Alpha
Clear Color
Custom Trigger
Custom Trigger Event
Color Format
Preset Colors
Custom Render Panel
API
Color
FAQ
Questions about color assignment

ColorPicker

  • CheckboxDatePicker

    Resources

    Namu Design Charts
    Namu Design Pro
    Namu Design Pro Components
    Namu Design Mobile
    Namu Design Mini
    Namu Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    ahooks-React Hooks Library
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Namu Design
    Medium
    Twitter
    yuqueNamu Design in YuQue
    Namu Design in Zhihu
    Experience Cloud Blog
    seeconfSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTechMore Products

    yuqueYuQue-Document Collaboration Platform
    AntVAntV-Data Visualization
    EggEgg-Enterprise Node.js Framework
    kitchenKitchen-Sketch Toolkit
    xtechAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Namu Design Community

    Components providing color selection, Available since 5.5.0.

    When To Use

    Used when the user needs to customize the color selection.

    Examples

    Basic Usage

    Basic Usage.

    expand codeexpand code
    controlled mode

    Set the component to controlled mode.

    expand codeexpand code
    Rendering Trigger Text

    Renders the default text of the trigger, effective when showText is true. When customizing text, you can use showText as a function to return custom text.

    expand codeexpand code
    Disabled Alpha

    Disabled color alpha.

    expand codeexpand code
    Custom Trigger

    Triggers for customizing color panels.

    expand codeexpand code
    Color Format

    Encoding formats, support HEX, HSB, RGB.

    expand codeexpand code
    Custom Render Panel

    Rendering of the free control panel via panelRender.

    expand codeexpand code
    Trigger size

    The trigger has three sizes: large, medium and small. If size is not set, the size will be medium.

    expand codeexpand code
    Color change completed

    The callback will be called only when the color selection is completed.

    expand codeexpand code
    Disable

    Set to disabled state.

    expand codeexpand code
    Clear Color

    Clear Color.

    expand codeexpand code
    Custom Trigger Event

    Triggers event for customizing color panels, provide options click and hover.

    expand codeexpand code
    Preset Colors

    Set the presets color of the color picker.

    expand codeexpand code

    API

    Common props ref:Common props

    This component is available since antd@5.5.0.

    PropertyDescriptionTypeDefaultVersion
    allowClearAllow clearing color selectedbooleanfalse
    arrowConfiguration for popup arrowboolean | { pointAtCenter: boolean }true
    childrenTrigger of ColorPickerReact.ReactNode-
    defaultValueDefault value of colorstring | Color-
    disabledDisable ColorPickerboolean-
    disabledAlphaDisable Alphaboolean-5.8.0
    destroyTooltipOnHideWhether destroy popover when hiddenbooleanfalse5.7.0
    formatFormat of colorrgb | hex | hsbhex
    openWhether to show popupboolean-
    presetsPreset colors{ label: ReactNode, colors: Array<string | Color> }[]-
    placementPlacement of popuptop | topLeft | topRight | bottom | bottomLeft | bottomRightbottomLeft
    panelRenderCustom Render Panel(panel: React.ReactNode, extra: { components: { Picker: FC; Presets: FC } }) => React.ReactNode-5.7.0
    showTextShow color textboolean | (color: Color) => React.ReactNode-5.7.0
    sizeSetting the trigger sizelarge | middle | smallmiddle5.7.0
    triggerColorPicker trigger modehover | clickclick
    valueValue of colorstring | Color-
    onChangeCallback when value is changed(value: Color, hex: string) => void-
    onChangeCompleteCalled when color pick ends(value: Color) => void-5.7.0
    onFormatChangeCallback when format is changed(format: 'hex' | 'rgb' | 'hsb') => void-
    onOpenChangeCallback when open is changed(open: boolean) => void-
    onClearCalled when clear() => void-5.6.0

    Color

    PropertyDescriptionTypeDefault
    toHexConvert to hex format characters, the return type like: 1677ff() => string-
    toHexStringConvert to hex format color string, the return type like: #1677ff() => string-
    toHsbConvert to hsb object() => ({ h: number, s: number, b: number, a number })-
    toHsbStringConvert to hsb format color string, the return type like: hsb(215, 91%, 100%)() => string-
    toRgbConvert to rgb object() => ({ r: number, g: number, b: number, a number })-
    toRgbStringConvert to rgb format color string, the return type like: rgb(22, 119, 255)() => string-

    FAQ

    Questions about color assignment

    The value of the color selector supports both string color values and selector-generated Color objects. However, since there is a precision error when converting color strings of different formats to each other, it is recommended to use selector-generated Color objects for assignment operations in controlled scenarios, so that the precision problem can be avoided and the values are guaranteed to be accurate and the selector can work as expected.

    #1677FF
    Custom Text (#1677ff)
    HEX: #1677ff
    HSB: hsb(215, 91%, 100%)
    RGB: rgb(22, 119, 255)
    Add title:
    Horizontal layout:
    #1677FF
    #1677FF
    #1677FF
    #1677FF