material-web/select/select-option.ts
Material Web Team edb3559a1c fix(select): expose SelectOption interface
PiperOrigin-RevId: 592022961
2023-12-18 15:14:41 -08:00

56 lines
1.8 KiB
TypeScript

/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {customElement} from 'lit/decorators.js';
import {styles} from '../menu/internal/menuitem/menu-item-styles.css.js';
// TODO(b/236285090): update with HCM best practices
import {SelectOptionEl} from './internal/selectoption/select-option.js';
export {SelectOption} from './internal/selectoption/select-option.js';
declare global {
interface HTMLElementTagNameMap {
'md-select-option': MdSelectOption;
}
}
/**
* @summary
* Select menus display a list of choices on temporary surfaces and display the
* currently selected menu item above the menu.
*
* @description
* The select component allows users to choose a value from a fixed list of
* available options. Composed of an interactive anchor button and a menu, it is
* analogous to the native HTML `<select>` element. This is the option that
* can be placed inside of an md-select.
*
* This component is a subclass of `md-menu-item` and can accept the same slots,
* properties, and events as `md-menu-item`.
*
* @example
* ```html
* <md-outlined-select label="fruits">
* <!-- An empty selected option will give select an "un-filled" state -->
* <md-select-option selected></md-select-option>
* <md-select-option value="apple" headline="Apple"></md-select-option>
* <md-select-option value="banana" headline="Banana"></md-select-option>
* <md-select-option value="kiwi" headline="Kiwi"></md-select-option>
* <md-select-option value="orange" headline="Orange"></md-select-option>
* <md-select-option value="tomato" headline="Tomato"></md-select-option>
* </md-outlined-select>
* ```
*
* @final
* @suppress {visibility}
*/
@customElement('md-select-option')
export class MdSelectOption extends SelectOptionEl {
static override styles = [styles];
}