MCPcopy Index your code
hub / github.com/adobe/react-spectrum / NumberField

Function NumberField

starters/tailwind/src/NumberField.tsx:21–60  ·  view source on GitHub ↗
({
  label,
  description,
  errorMessage,
  placeholder,
  ...props
}: NumberFieldProps)

Source from the content-addressed store, hash-verified

19}
20
21export function NumberField({
22 label,
23 description,
24 errorMessage,
25 placeholder,
26 ...props
27}: NumberFieldProps) {
28 return (
29 <AriaNumberField
30 {...props}
31 className={composeTailwindRenderProps(
32 props.className,
33 'group flex flex-col gap-1 font-sans'
34 )}>
35 <Label>{label}</Label>
36 <FieldGroup>
37 {renderProps => (
38 <>
39 <Input className="w-20" placeholder={placeholder} />
40 <div
41 className={fieldBorderStyles({
42 ...renderProps,
43 class: 'flex flex-col border-s h-full'
44 })}>
45 <StepperButton slot="increment">
46 <ChevronUp aria-hidden className="w-4 h-4" />
47 </StepperButton>
48 <div className={fieldBorderStyles({...renderProps, class: 'border-b'})} />
49 <StepperButton slot="decrement">
50 <ChevronDown aria-hidden className="w-4 h-4" />
51 </StepperButton>
52 </div>
53 </>
54 )}
55 </FieldGroup>
56 {description && <Description>{description}</Description>}
57 <FieldError>{errorMessage}</FieldError>
58 </AriaNumberField>
59 );
60}
61
62function StepperButton(props: ButtonProps) {
63 return (

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected