Sure! Here's the English version of the documentation:
ColorPickerProps
ColorPickerProps
is the type of properties for the ColorPicker
component. It can be defined in the following two ways:
title
propertytitle
(string
): Provides a title for the color picker, describing its purpose or offering guidance to the user.children
propertychildren
(VirtualNode | undefined | null | (VirtualNode | undefined | null)[]
| VirtualNode
): A custom view that describes the usage of the selected color. The system color picker UI will use the text of this view to set the title. If you don't use children
, you can simply use title
.value
(Color
): The current selected color value. It can be a keyword color, hexadecimal color string, or RGBA string.
onChanged
((value: Color) => void
): A callback function triggered when the color changes. This callback is invoked with the new color value when the user selects a new color.
supportsOpacity
(boolean
, optional): If set to true
, allows the user to adjust the opacity of the selected color. The default is true
.
ColorPicker
The ColorPicker
component provides a system color picker UI that allows users to select a color and passes the selected color back to the application via the onChanged
event. It supports the following formats for colors:
green
, red
, blue
, etc.)#FF5733
or #333
)rgba(255,0,0,1)
)In the example above:
ColorPicker
component’s title
is set to "Pick a Color"
, instructing the user to choose a color.#FF5733
.onChanged
callback is triggered when the color changes, updating the color
state.If you wish to allow adjusting the opacity of the selected color, you can enable this feature by setting the supportsOpacity
property:
Color
TypeThe Color
type is used to define various color formats, including:
"red"
, "green"
, "blue"
, etc."#FF5733"
.rgba(255, 0, 0, 0.5)
.The ColorPicker
component is a powerful tool that allows users to easily pick a color, with support for opacity adjustments. By passing different properties, you can customize the appearance and behavior of the color picker.