Fill picker
None, a solid colour or a dither pattern, with opacity.
import { FillPicker, PatternSwatch, EDITOR_FILL_PATTERNS, editorPatternCells } from "@forgeron/ui";import { FillPicker, type EditorFill } from "@forgeron/ui";
import { useState } from "react";
export default function Default() {
const [fill, setFill] = useState<EditorFill>({
type: "pattern",
pattern: "hatch",
color: "#ff4f1f",
});
return (
<div style={{ width: "100%", maxWidth: 320 }}>
<FillPicker label="Fill" value={fill} onChange={setFill} />
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Names the panel: “Fill”. |
value / defaultValue / onChange | { type: “none” } | { type: “solid”, color, opacity? } | { type: “pattern”, pattern, color, opacity? } | — | A fill. Switching kind keeps the last colour. |
patterns | string[] | — | Pattern ids offered (dots-25, dots-50, dots-75, lines-h, lines-v, hatch, hatch-back, cross). Empty hides the Pattern tab. |
opacity | boolean | true | The opacity slider. |
disabled | boolean | — | Greys out the whole panel. |
className | string | — | Extra classes. |