Skip to main content
Glama
deleonio
by deleonio
NativeOption.tsx1.5 kB
import { h, type FunctionalComponent as FC } from '@stencil/core'; import type { JSXBase } from '@stencil/core/internal'; import clsx from 'clsx'; import type { StencilUnknown, W3CInputValue } from '../../../schema'; export type NativeOptionProps = Omit<JSXBase.OptionHTMLAttributes<HTMLOptionElement>, 'value' | 'label'> & { selectedValue?: StencilUnknown | StencilUnknown[]; value: StencilUnknown; label: W3CInputValue; index?: string | number; baseClassName?: 'kol-select' | 'kol-datalist'; }; const NativeOptionFc: FC<NativeOptionProps> = ({ baseClassName = 'kol-select', class: classNames, index, selectedValue, selected, value, label, disabled, ...other }) => { if (selectedValue === undefined) { selectedValue = []; } else if (!Array.isArray(selectedValue)) { selectedValue = [selectedValue]; } const isSelected = selected || (selectedValue as StencilUnknown[]).includes(value); return ( <option class={clsx( `${baseClassName}__option`, { [`${baseClassName}__option--selected`]: isSelected, [`${baseClassName}__option--disabled`]: disabled, }, classNames, )} selected={isSelected} // removed the aria-hidden attribute because the browser caused errors and ignores it // see also: // - https://github.com/public-ui/kolibri/issues/7755 // - https://github.com/public-ui/public-ui.github.io/issues/336 disabled={disabled} value={index} {...other} > {label} </option> ); }; export default NativeOptionFc;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server