UNPKG

@styleless-ui/react

Version:

Completely unstyled, headless and accessible React UI components.

34 lines (33 loc) 1.04 kB
import * as React from "react"; import type { MergeElementProps } from "../typings"; interface OwnProps { /** * The content of the component. */ children?: React.ReactNode | ((ctx: { expanded: boolean; }) => React.ReactNode); /** * The className applied to the component. */ className?: string | ((ctx: { expanded: boolean; }) => string); /** * If `true`, the panel will be opened. */ expanded?: boolean; /** * The default state of the `expanded`. Use when `expanded` is not controlled. */ defaultExpanded?: boolean; /** * The Callback is fired when the `expand` state changes. * * Only updates from `<Expandable.Trigger>` component trigger the callback. */ onExpandChange?: (isExpanded: boolean) => void; } export type Props = Omit<MergeElementProps<"div", OwnProps>, "defaultChecked" | "defaultValue">; declare const Expandable: (props: Props, ref: React.Ref<HTMLDivElement>) => JSX.Element; export default Expandable;