import * as React from 'react'; import { SwatchColorPicker } from '@fluentui/react/lib/SwatchColorPicker'; const colorCellsExample1 = [ { id: 'a', label: 'orange', color: '#ca5010' }, { id: 'b', label: 'cyan', color: '#038387' }, { id: 'c', label: 'blueMagenta', color: '#8764b8' }, { id: 'd', label: 'magenta', color: '#881798' }, { id: 'e', label: 'white', color: '#ffffff' }, ]; const colorCellsExample2 = [ { id: 'a', label: 'red', color: '#a4262c' }, { id: 'b', label: 'orange', color: '#ca5010' }, { id: 'c', label: 'orangeYellow', color: '#986f0b' }, { id: 'd', label: 'yellowGreen', color: '#8cbd18' }, { id: 'e', label: 'green', color: '#0b6a0b' }, { id: 'f', label: 'cyan', color: '#038387' }, { id: 'g', label: 'cyanBlue', color: '#004e8c' }, { id: 'h', label: 'magenta', color: '#881798' }, { id: 'i', label: 'magentaPink', color: '#9b0062' }, { id: 'j', label: 'black', color: '#000000' }, { id: 'k', label: 'gray', color: '#7a7574' }, { id: 'l', label: 'gray20', color: '#69797e' }, ]; export const SwatchColorPickerBasicExample: React.FunctionComponent = () => { const [previewColor, setPreviewColor] = React.useState(); const swatchColorPickerOnCellHovered = (id: string, color: string) => { setPreviewColor(color!); }; return (
Simple circle swatch color picker:
Simple square swatch color picker with default size of 20px:
Simple square swatch color picker with custom size of 35px:
Simple swatch color picker with multiple rows and larger cells that updates its icon color and shows a preview color:
Sample Text
Simple disabled circle swatch color picker:
); };