Iconography

Exports

Import these components from @mbsw/ui.

Icon

Props

The tables list common props for each component. See the full types for supported prop combinations and inherited HTML and Radix props.

Icon

Icon props
PropTypeRequirement
iconIconComponentRequired
position"inline-start" | "inline-end"Optional
size"lg" | "md" | "sm" | "xl" | "xs" | "3xs" | "2xs" | "2xl" | "3xl" | "4xl"Optional
decorativebooleanConditional
labelstringConditional

Type reference

Show full types

Full TypeScript definitions, including prop combinations and inherited props.

import { type ElementType, type SVGProps } from 'react';

declare const iconSizes: readonly ["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl"];

export type IconSize = (typeof iconSizes)[number];

type IconComponent = ElementType<SVGProps<SVGSVGElement>>;

type BaseIconProps = Omit<SVGProps<SVGSVGElement>, 'aria-hidden' | 'aria-label' | 'children' | 'height' | 'role' | 'stroke' | 'strokeWidth' | 'width'> & {
    icon: IconComponent;
    position?: 'inline-start' | 'inline-end';
    size?: IconSize;
};

type DecorativeIconProps = {
    decorative?: true;
    label?: never;
};

type AccessibleIconProps = {
    decorative: false;
    label: string;
};

export type IconProps = BaseIconProps & (DecorativeIconProps | AccessibleIconProps);

export declare function Icon({ decorative, icon: IconComponent, label, position, size, style, ...props }: IconProps): import("react").ReactElement<SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;