Skip to main content

InputColor Component

Description

The InputColor component allows users to select colors using an interactive color picker. It supports:

  • Customizable color selection.
  • Fullscreen mode for small screens.
  • Draggable & resizable dialogs for desktop users.
  • Real-time preview of selected color.

Props

PropTypeDefaultDescription
idstring-Unique identifier for the input field.
labelstring-Label displayed above the input field.
onChange(e: React.ChangeEvent<HTMLInputElement>) => void-Callback triggered when the color changes.
valuestring""Initial selected color in HEX format.
disabledbooleanfalseDisables color selection.

Example Usage

import { InputColor } from "@nomana-it/liberty-core"
import { useState } from "react";

export const InputColorExample = () => {
const [color, setColor] = useState("#ff0000");

const handleColorChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setColor(e.target.value);
};

return (
<InputColor
id="custom-color-picker"
label="Select a Color"
value={color}
onChange={handleColorChange}
/>
);
};

🔗 GitHub Repository (Core): Liberty Core
🔗 GitHub Repository (Test Project): Liberty Test
📖 Live Documentation: Liberty Core Docs
💖 Sponsor & Support: Sponsor Liberty Core