@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
39 lines (38 loc) • 1.16 kB
TypeScript
import React, { SelectHTMLAttributes } from "react";
import { FormFieldProps } from "../useFormField";
export interface SelectProps extends FormFieldProps, Omit<SelectHTMLAttributes<HTMLSelectElement>, "size" | "multiple"> {
/**
* Collection of <option />-elements.
*/
children: React.ReactNode;
/**
* Sets inline-style on select wrapper.
*/
style?: React.CSSProperties;
/**
* Label for select.
*/
label: React.ReactNode;
/**
* Shows label and description for screenreaders only.
*/
hideLabel?: boolean;
}
/**
* A component that displays a select input field.
*
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/select)
* @see 🏷️ {@link SelectProps}
*
* @example
* ```jsx
* <Select label="Hvilket land har du bosted i.">
* <option value="">Velg land</option>
* <option value="norge">Norge</option>
* <option value="sverige">Sverige</option>
* <option value="danmark">Danmark</option>
* </Select>
* ```
*/
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
export default Select;