alouette
Version:
A modern, customizable design system built on top of NativeWind v5 with configurable defaults
38 lines • 1.86 kB
TypeScript
import { type ReactNode } from "react";
import type { AccentOrNeutral } from "../../core/AlouetteConfig";
import { type ButtonProps, type ButtonSize, type ButtonState } from "./Button";
export type SplitButtonVariant = Exclude<NonNullable<ButtonProps["variant"]>, "soft">;
interface SplitButtonBaseProps {
/** Names the group, the caret and the menu it opens ("Merge method"). */
menuLabel: string;
/** Picking an option in the menu selects it; it does not run it. */
onValueChange?: (value: string) => void;
/** Runs the selected option, from the main button. */
onPress: (value: string) => void;
/** Defaults to `tonal`. No `soft`: a text button has no ground to split. */
variant?: SplitButtonVariant;
size?: ButtonSize;
/** Defaults to the inherited accent, or `brand` outside an accent scope. */
accent?: AccentOrNeutral;
disabled?: boolean;
/** The main button's state; the caret is disabled while it is set. */
state?: ButtonState;
/** `SplitButtonOption`s only: they also render as the main button's label. */
children: ReactNode;
}
export interface SplitButtonControlledProps extends SplitButtonBaseProps {
value: string;
defaultValue?: never;
}
export interface SplitButtonUncontrolledProps extends SplitButtonBaseProps {
value?: never;
defaultValue: string;
}
export type SplitButtonProps = SplitButtonControlledProps | SplitButtonUncontrolledProps;
/**
* A button that runs one of several actions, with a caret opening the menu
* that picks which: the main button always shows and runs the selected one.
*/
export declare function SplitButton({ menuLabel, value: controlledValue, defaultValue, onValueChange, onPress, variant, size, accent: accentProp, disabled, state, children, }: SplitButtonProps): ReactNode;
export {};
//# sourceMappingURL=SplitButton.d.ts.map