You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ColorPicker is used to browse through and select colors. By default, it lets people navigate through colors on a color spectrum; or specify a color in either Red-Green-Blue (RGB); or alpha color code; or Hexadecimal textboxes.
Layout variants:
Vertical
When color names and button on the bottom side
Horizontal
When color names and buttons from the right side
Choosing color on click in React spectrum
Props
ColorPicker
defaultValue
value
onChange
sliderShape - some partners might want to change a shape
import*asReactfrom'react';import{ColorPicker,ChoiceGroup,IChoiceGroupOption,getColorFromString,IColor,IColorPickerStyles,IColorPickerProps,}from'@fluentui/react';constwhite=getColorFromString('#ffffff')!;constColorPickerBasicExample: React.FunctionComponent=()=>{const[color,setColor]=React.useState(white);const[showPreview,setShowPreview]=React.useState(true);const[alphaType,setAlphaType]=React.useState<IColorPickerProps['alphaType']>('alpha');constupdateColor=React.useCallback((ev: any,colorObj: IColor)=>setColor(colorObj),[]);return(<div><divid={`${baseId}-circle`}>Simple circle swatch color picker:</div><ColorPickercolor={color}onChange={updateColor}alphaType={alphaType}showPreview={showPreview}styles={colorPickerStyles}// The ColorPicker provides default English strings for visible text.// If your app is localized, you MUST provide the `strings` prop with localized strings.strings={{// By default, the sliders will use the text field labels as their aria labels.// Previously this example had more detailed instructions in the labels, but this is// a bad practice and not recommended. Labels should be concise, and match visible text when possible.hueAriaLabel: 'Hue',}}/></div>);};
Intro
The ColorPicker is used to browse through and select colors. By default, it lets people navigate through colors on a color spectrum; or specify a color in either Red-Green-Blue (RGB); or alpha color code; or Hexadecimal textboxes.
Layout variants:
Vertical
When color names and button on the bottom side
![image](https://private-user-images.githubusercontent.com/11574680/346608836-7cdefbb3-5711-4d27-9ee3-9ac78866164f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1ODcyNTEsIm5iZiI6MTcyMDU4Njk1MSwicGF0aCI6Ii8xMTU3NDY4MC8zNDY2MDg4MzYtN2NkZWZiYjMtNTcxMS00ZDI3LTllZTMtOWFjNzg4NjYxNjRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEwVDA0NDkxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAwOTE3OTdjMTBkN2Q1ZThkOGUzN2ZkMjIyYzU5NmVmM2E0NzAxZDlkNDg4MWQwMzA3N2I1YWYwOGU0Y2U0MzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.KLR8gzqJdYbOjNk571c-KgbEuxShAlHZ6K-BDBf18Ok)
Horizontal
When color names and buttons from the right side
![image](https://private-user-images.githubusercontent.com/11574680/346610911-86ba03c2-bb31-4b07-8b9a-11d40788fe32.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1ODcyNTEsIm5iZiI6MTcyMDU4Njk1MSwicGF0aCI6Ii8xMTU3NDY4MC8zNDY2MTA5MTEtODZiYTAzYzItYmIzMS00YjA3LThiOWEtMTFkNDA3ODhmZTMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEwVDA0NDkxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU5YjkyNDJkMmRhNmIyZjBhYTlmMzkwNWZmNGRkMmVlMTFlNGY0OTlkZDFiOWQzNmNmN2NlOTI4MmQwNzUxZDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._XV2dFsTf8XUadoXe4mP1e8KPcCcAM3xCMePoHY0cio)
Choosing color on click in React spectrum
Props
ColorPicker
defaultValue
value
onChange
sliderShape
- some partners might want to change a shapeColorSlider
AlphaChannelSlider
PreviewBox:
shape
size
Example of existing (V8) ColorPicker
[Add a picture here]
https://developer.microsoft.com/en-us/fluentui#/controls/web/colorpicker
https://learn.microsoft.com/en-us/windows/apps/design/controls/color-picker
Fabric (v8)
Component structure
ColorPicker component
Color picker can contain sub-components:
Color format:
Questions:
Notes:
Resources:
For learning and research I used Adobe DS: https://react-spectrum.adobe.com/react-spectrum/ColorPicker.html
The text was updated successfully, but these errors were encountered: