2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Form Controls

ColorInput

Updated: May 12, 2025
View on GitHub
The ColorInput component provides an enhanced color picker that displays the selected color as a visual preview alongside its hex value. It extends the standard HTML color input with a more user-friendly interface.
  • Color Preview: Shows a visual preview of the selected color
  • Hex Value Display: Displays the hex code of the selected color
  • Native Color Picker: Uses the browser's native color picker for selection
  • Reset Option: Includes a button to clear the selected color
  • Alpha Support: Optional opacity/transparency control via dropdown slider
Enable alpha channel (transparency) control by setting supportAlpha to true. This adds an opacity button that opens a dropdown with a slider to adjust transparency from 0-100%. When supportAlpha is enabled:
  • The value is automatically converted to rgba(r, g, b, a) format
  • An opacity icon appears in the input suffix
  • Clicking the icon opens a dropdown with a slider (0-100% opacity)
  • The color preview shows transparency
  • The display text shows RGBA values
The ColorInput component extends the standard Input component props with the following modifications:
Prop
Type
Default
valuerequired
The current colour, as hex or rgba. Controlled — pair it with onChange.
string
onChangerequired
Receives the colour string directly, not a DOM event.
(value: string) => void
supportAlpha
Adds an opacity slider and switches the value to rgba().
booleanfalse
…and every InputProps propinherited
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club