@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
75 lines (74 loc) • 2.93 kB
TypeScript
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type React from 'react';
import { type HtmlAttributes, type PolymorphicCommonProps } from '../_common/types';
/**
*
* Types
*
*/
type ButtonTypes = 'submit' | 'button' | 'reset';
export type ButtonSizes = 'small' | 'medium' | 'large';
export type ButtonVariants = 'primary' | 'danger' | 'neutral';
export type CommonButtonProps = {
children?: React.ReactNode;
/** Icon to display before the button content */
leadingVisual?: React.ReactNode;
/** If the button is doing something Async, it will display a loading spinner */
isLoading?: boolean;
/** If the button is in disabled state */
isDisabled?: boolean;
/** If the button is fluid, it will take the full width of its container */
isFluid?: boolean;
/** Type of button */
type?: ButtonTypes;
/** Size of button */
size?: ButtonSizes;
/** onClick callback*/
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
/** onKeyDown callback */
onKeyDown?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
} /**
* If `as="a"`, `href` is required and `target` is available.
* For all other elements, these props are not present.
*/ & ({
as: 'a';
/** The URL to link to. Only applies when `as="a"` */
href?: HtmlAttributes<'a'>['href'];
/**
* The target window for the link. Only applies when `as="a"`.
* Not present or required for other element types.
*/
target?: HtmlAttributes<'a'>['target'];
} | {
as?: React.ElementType;
});
type ButtonBaseProps = CommonButtonProps & {
/** If the button is in floating state */
isFloating?: boolean;
/** variant of the button */
variant?: ButtonVariants;
/** fill of the button */
buttonFill?: 'filled' | 'outlined' | 'text';
};
export declare const ButtonBase: <T extends React.ElementType = "button">({ as, buttonFill, children, className, variant, htmlAttributes, isDisabled, isFloating, isFluid, isLoading, leadingVisual, onClick, ref, size, style, type, ...restProps }: PolymorphicCommonProps<T, ButtonBaseProps>) => import("react/jsx-runtime").JSX.Element;
export {};
//# sourceMappingURL=ButtonBase.d.ts.map