
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@zendeskgarden/container-combobox
Advanced tools
Containers relating to Combobox in the Garden Design System
This package includes containers relating to Combobox in the Garden Design System.
npm install @zendeskgarden/container-combobox
The combobox container encapsulates complexity while supporting a wide variety of standard features. Core logic and events are backed by Downshift. Standard naming and behaviors are finessed to suit Garden's point of view.
<select>
)Check out storybook for live examples.
import { useCombobox } from '@zendeskgarden/container-combobox';
const Combobox = () => {
const triggerRef = createRef();
const inputRef = createRef();
const listboxRef = createRef();
const options = [
{ value: 'value-1', label: 'One' },
{ value: 'value-2', label: 'Two' },
{ value: 'value-3', label: 'Three' }
];
const {
getLabelProps,
getInputProps,
getTriggerProps,
getListboxProps,
getOptionProps,
isExpanded
} = useCombobox({
triggerRef,
inputRef,
listboxRef,
options
});
return (
<>
<label {...getLabelProps()}>Label</label>
<input {...getInputProps()} />
<button {...getTriggerProps()}>▼</button>
<ul
{...getListboxProps({ 'aria-label': 'Options' })}
style={{ visibility: isExpanded ? 'visible' : 'hidden' }}
>
{options.map((option, index) => (
<li key={index} {...getOptionProps({ option })}>
{option.label}
</li>
))}
</ul>
</>
);
};
import { ComboboxContainer } from '@zendeskgarden/container-combobox';
const Combobox = () => {
const triggerRef = createRef();
const inputRef = createRef();
const listboxRef = createRef();
const options = [
{ value: 'value-1', label: 'One' },
{ value: 'value-2', label: 'Two' },
{ value: 'value-3', label: 'Three' }
];
return (
<ComboboxContainer
triggerRef={triggerRef}
inputRef={inputRef}
listboxRef={listboxRef}
options={options}
>
{({
getLabelProps,
getInputProps,
getTriggerProps,
getListboxProps,
getOptionProps,
isExpanded
}) => (
<>
<label {...getLabelProps()}>Label</label>
<input {...getInputProps()} />
<button {...getTriggerProps()}>▼</button>
<ul
{...getListboxProps({ 'aria-label': 'Options' })}
style={{ visibility: isExpanded ? 'visible' : 'hidden' }}
>
{options.map((option, index) => (
<li key={index} {...getOptionProps({ option })}>
{option.label}
</li>
))}
</ul>
</>
)}
</ComboboxContainer>
);
};
FAQs
Containers relating to Combobox in the Garden Design System
The npm package @zendeskgarden/container-combobox receives a total of 47,635 weekly downloads. As such, @zendeskgarden/container-combobox popularity was classified as popular.
We found that @zendeskgarden/container-combobox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.