@asgardeo/react
Version:
React implementation of Asgardeo JavaScript SDK.
88 lines (87 loc) • 2.48 kB
TypeScript
/**
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { ButtonHTMLAttributes } from 'react';
export type ButtonColor = 'primary' | 'secondary' | 'tertiary' | string;
export type ButtonVariant = 'solid' | 'outline' | 'text' | 'icon';
export type ButtonSize = 'small' | 'medium' | 'large';
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
/**
* The button color that determines the color scheme
*/
color?: ButtonColor;
/**
* The button variant that determines the visual style
*/
variant?: ButtonVariant;
/**
* The size of the button
*/
size?: ButtonSize;
/**
* Whether the button should take the full width of its container
*/
fullWidth?: boolean;
/**
* Whether the button is in a loading state
*/
loading?: boolean;
/**
* Icon to display before the button text
*/
startIcon?: React.ReactNode;
/**
* Icon to display after the button text
*/
endIcon?: React.ReactNode;
/**
* The shape of the button: square or round
*/
shape?: 'square' | 'round';
}
/**
* Button component with multiple variants and types.
*
* @example
* ```tsx
* // Primary solid button
* <Button color="primary" variant="solid">
* Click me
* </Button>
*
* // Secondary outline button
* <Button color="secondary" variant="outline" size="large">
* Cancel
* </Button>
*
* // Text button with loading state
* <Button color="tertiary" variant="text" loading>
* Loading...
* </Button>
*
* // Button with icons
* <Button
* color="primary"
* startIcon={<Icon />}
* endIcon={<Arrow />}
* >
* Save and Continue
* </Button>
* ```
*/
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
export default Button;