carbon-react
Version:
A library of reusable React components for easily building user interfaces.
39 lines (38 loc) • 1.66 kB
TypeScript
import React from "react";
import { MarginProps } from "styled-system";
import { IconType } from "../icon";
import { TagProps } from "../../__internal__/utils/helpers/tags";
export interface SplitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, MarginProps, TagProps {
/** Set align of the rendered content */
align?: "left" | "right";
/** Button type: "primary" | "secondary" */
buttonType?: "primary" | "secondary";
/** The additional button to display. */
children: React.ReactNode;
/** Prop to specify an aria-label for the component */
"aria-label"?: string;
/** Gives the button a disabled state. */
disabled?: boolean;
/** Defines an Icon position within the button: "before" | "after" */
iconPosition?: "before" | "after";
/** Defines an Icon type within the button */
iconType?: IconType;
/** The size of the buttons. */
size?: "small" | "medium" | "large";
/** Second text child, renders under main text, only when size is "large" */
subtext?: string;
/** The text to be displayed in the main button. */
text: string;
/** Sets rendering position of menu */
position?: "left" | "right";
/** Renders the white variant of the secondary split button */
isWhite?: boolean;
}
export type SplitButtonHandle = {
/** Programmatically focus the main button */
focusMainButton: () => void;
/** Programmatically focus the toggle button. */
focusToggleButton: () => void;
} | null;
export declare const SplitButton: React.ForwardRefExoticComponent<SplitButtonProps & React.RefAttributes<SplitButtonHandle>>;
export default SplitButton;