@ozen-ui/kit
Version:
React component library
53 lines (52 loc) • 2.45 kB
TypeScript
import './Button.css';
import type { ReactNode, ElementType, ComponentPropsWithRef } from 'react';
import type { IconProps } from '@ozen-ui/icons';
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
import type { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
import type { RenderContentType } from '../../utils/renderContent';
import { BUTTON_DEFAULT_TAG } from './constants';
export declare const buttonVariant: readonly ["contained", "outlined", "ghost", "function"];
export declare const buttonColorVariant: readonly ["primary", "secondary", "warning", "error"];
export type ButtonVariant = (typeof buttonVariant)[number];
export type ButtonColorVariant = (typeof buttonColorVariant)[number];
export type ButtonIcon = RenderContentType<IconProps>['content'];
type ButtonBaseProps = {
/**
* Вариант отображения кнопки
* @default contained
* */
variant?: ButtonVariant;
/**
* Размер
* @default m
* */
size?: FormElementSizeVariant;
/**
* Цвет
* @default primary
* */
color?: ButtonColorVariant;
/** Содержимое кнопки */
children?: ReactNode;
/** Если `true` делает кнопку заблокированной */
disabled?: boolean;
/** Если `true` переводит кнопку в состояние загрузки */
loading?: boolean;
/** Дополнительные CSS-классы */
className?: string;
/** Иконка слева */
iconLeft?: ButtonIcon;
/** Иконка справа */
iconRight?: ButtonIcon;
/** Если `true` растягивает кнопку на всю ширину родительского контейнера */
fullWidth?: boolean;
/** Свойства лейбла кнопки */
labelProps?: ComponentPropsWithRef<'span'>;
};
export type ButtonProps<As extends ElementType = typeof BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ButtonBaseProps, As>;
export declare const cnButton: import("@bem-react/classname").ClassNameFormatter;
/**
* @deprecated Компонент устарел. Для замены используйте компонент ButtonNext
*/
export declare const Button: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ButtonBaseProps, "button", "as">;
export {};