@@ -28,6 +28,7 @@ Use the `value` or `defaultValue` prop to set the color value, and `onChange` to
2828import {ColorField } from ' @react-spectrum/s2' ;
2929import {useState } from ' react' ;
3030import {parseColor } from ' @react-stately/color' ;
31+ import {style } from ' @react-spectrum/s2/style' with {type: ' macro' };
3132
3233function Example() {
3334 let [value, setValue] = useState (parseColor (' #e73623' ));
@@ -39,7 +40,7 @@ function Example() {
3940 placeholder = " Enter a color"
4041 value = { value }
4142 onChange = { setValue } />
42- <pre style = { {fontSize: 12 } } >Current value: { value .toString (' hex' )} </pre >
43+ <pre className = { style ({font: ' body ' }) } >Current value: { value .toString (' hex' )} </pre >
4344 </div >
4445 );
4546}
@@ -52,13 +53,14 @@ By default, ColorField displays a hex value. Set the `colorSpace` and `channel`
5253``` tsx render
5354" use client" ;
5455import {ColorField , parseColor } from ' @react-spectrum/s2' ;
56+ import {style } from ' @react-spectrum/s2/style' with {type: ' macro' };
5557import {useState } from ' react' ;
5658
5759function Example() {
5860 let [color, setColor] = useState (parseColor (' #7f007f' ));
5961
6062 return (
61- <div style = { { display: ' flex' , flexDirection: ' column' , gap: 8 }} >
63+ <div className = { style ( { display: ' flex' , flexDirection: ' column' , gap: 8 }) } >
6264 <ColorField
6365 label = " Hue"
6466 placeholder = " Select a hue"
@@ -82,7 +84,7 @@ function Example() {
8284 onChange = { setColor }
8385 colorSpace = " hsl"
8486 channel = " lightness" />
85- <pre style = { {fontSize: 12 } } >Current value: { color ?.toString (' hex' )} </pre >
87+ <pre className = { style ({font: ' body ' }) } >Current value: { color ?.toString (' hex' )} </pre >
8688 </div >
8789 );
8890}
0 commit comments