Custom Color Picker
Replace the built-in color picker with your own component
Overview
Component
Where the picker appears
Writing a custom picker
import type { ColorSelectorProps } from "@rowsncolumns/spreadsheet";
const BrandColorSelector = ({
color,
onChange,
theme,
resetButtonTitle = "Automatic",
userDefinedColors,
onAddUserDefinedColor,
}: ColorSelectorProps) => {
const brandColors = ["#1E40AF", "#F59E0B", "#10B981", "#EF4444"];
return (
<div className="flex flex-col gap-1 p-2">
<button onClick={() => onChange?.(undefined)}>{resetButtonTitle}</button>
<div className="flex gap-1">
{brandColors.map((value) => (
<button
key={value}
aria-label={`Select ${value}`}
style={{ backgroundColor: value, width: 24, height: 24 }}
onClick={() => onChange?.(value)}
/>
))}
</div>
</div>
);
};Prop
Type
Description
Usage in the toolbar
Sheet tab color picker
Floating cell editor
Best practices
Last updated