MCPcopy Create free account
hub / github.com/adobe/react-spectrum / NumberControl

Function NumberControl

packages/dev/s2-docs/src/VisualExampleClient.tsx:909–942  ·  view source on GitHub ↗
({control, value, onChange}: ControlProps)

Source from the content-addressed store, hash-verified

907}
908
909function NumberControl({control, value, onChange}: ControlProps) {
910 if (control.options?.control === 'slider') {
911 return (
912 <Slider
913 label={control.name}
914 contextualHelp={<PropContextualHelp control={control} />}
915 value={value}
916 onChange={onChange}
917 styles={style({width: controlWidth})}
918 />
919 );
920 }
921
922 return (
923 <NumberField
924 label={control.name}
925 placeholder="–"
926 contextualHelp={<PropContextualHelp control={control} />}
927 value={value}
928 onChange={onChange}
929 styles={style({width: controlWidth})}
930 minValue={control.options?.minValue}
931 maxValue={control.options?.maxValue}
932 formatOptions={
933 control.name === 'delay' || control.name === 'closeDelay'
934 ? {
935 style: 'unit',
936 unit: 'millisecond'
937 }
938 : undefined
939 }
940 />
941 );
942}
943
944function NumberFormatControl({control, value, onChange}: ControlProps) {
945 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected