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

Function ComboBox

starters/docs/src/ComboBox.tsx:28–53  ·  view source on GitHub ↗
({
  label,
  description,
  errorMessage,
  children,
  placeholder,
  ...props
}: ComboBoxProps<T, M>)

Source from the content-addressed store, hash-verified

26}
27
28export function ComboBox<T, M extends 'single' | 'multiple' = 'single'>({
29 label,
30 description,
31 errorMessage,
32 children,
33 placeholder,
34 ...props
35}: ComboBoxProps<T, M>) {
36 return (
37 <AriaComboBox {...props}>
38 {label && <Label>{label}</Label>}
39 <div className="combobox-field">
40 <Input className="react-aria-Input inset" placeholder={placeholder} />
41 <FieldButton>
42 <ChevronDown />
43 </FieldButton>
44 </div>
45 {props.selectionMode === 'multiple' && <ComboBoxValue placeholder="No items selected" />}
46 {description && <Description>{description}</Description>}
47 <FieldError>{errorMessage}</FieldError>
48 <Popover hideArrow className="combobox-popover">
49 <ComboBoxListBox>{children}</ComboBoxListBox>
50 </Popover>
51 </AriaComboBox>
52 );
53}
54
55export function ComboBoxListBox<T>(props: ListBoxProps<T>) {
56 return <DropdownListBox {...props} />;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected