UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

64 lines (63 loc) 1.93 kB
import React from "react"; import { AkselColor } from "../types"; import type { OverridableComponent } from "../utils-external"; type legacyVariants = "primary-neutral" | "secondary-neutral" | "tertiary-neutral" | "danger"; type HiddenVariant = legacyVariants & { __brand?: never; }; export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { /** * Button content. */ children?: React.ReactNode; /** * Changes design and interaction-visuals. * @default "primary" */ variant?: "primary" | "secondary" | "tertiary" | HiddenVariant; /** * Changes padding, height, and font-size. * @default "medium" */ size?: "medium" | "small" | "xsmall"; /** * **Avoid using if possible for accessibility purposes**. * * Prevent the user from interacting with the button: it cannot be pressed or focused. */ disabled?: boolean; /** * Replaces button content with a Loader component, keeps width. * @default false */ loading?: boolean; /** * Button Icon. */ icon?: React.ReactNode; /** * Icon position in Button. * @default "left" */ iconPosition?: "left" | "right"; /** * Overrides inherited color. * * We recommend only using `accent`, `neutral` and `danger`. * @see 🏷️ {@link AkselColor} * @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens) */ "data-color"?: AkselColor; } /** * A button component * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/button) * @see 🏷️ {@link ButtonProps} * @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support * @example * ```jsx * <Button>Klikk meg</Button> * ``` */ export declare const Button: OverridableComponent<ButtonProps, HTMLButtonElement>; export default Button;