UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

31 lines 1.03 kB
import * as React from 'react'; import type { BaseUIComponentProps } from "../../utils/types.js"; /** * A text label of the currently selected item. * Renders a `<span>` element. * * Documentation: [Base UI Select](https://base-ui.com/react/components/select) */ export declare const SelectValue: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>; export interface SelectValueState { /** * The value of the currently selected item. */ value: any; } export interface SelectValueProps extends Omit<BaseUIComponentProps<'span', SelectValue.State>, 'children'> { /** * Accepts a function that returns a `ReactNode` to format the selected value. * @example * ```tsx * <Select.Value> * {(value: string | null) => value ? labels[value] : 'No value'} * </Select.Value> * ``` */ children?: React.ReactNode | ((value: any) => React.ReactNode); } export declare namespace SelectValue { type State = SelectValueState; type Props = SelectValueProps; }