import * as React from 'react'; import type { ComponentRenderFn } from "../utils/types.js"; import { HTMLProps } from "../utils/types.js"; import { StateAttributesMapping } from "../utils/getStateAttributesProps.js"; /** * Renders a Base UI element. * * @public */ export declare function useRender, RenderedElementType extends Element, Enabled extends boolean | undefined = undefined>(params: useRender.Parameters): useRender.ReturnValue; export type UseRenderRenderProp> = ComponentRenderFn, State> | React.ReactElement>; export type UseRenderElementProps = React.ComponentPropsWithRef; export type UseRenderComponentProps = React.ComponentPropsWithRef & { /** * Allows you to replace the component’s HTML element * with a different tag, or compose it with another component. * * Accepts a `ReactElement` or a function that returns the element to render. */ render?: ComponentRenderFn | React.ReactElement>; }; export interface UseRenderParameters { /** * The React element or a function that returns one to override the default element. */ render?: UseRenderRenderProp; /** * The ref to apply to the rendered element. */ ref?: React.Ref | React.Ref[]; /** * The state of the component, passed as the second argument to the `render` callback. * State properties are automatically converted to data-* attributes. */ state?: State; /** * Custom mapping for converting state properties to data-* attributes. * @example * { isActive: (value) => (value ? { 'data-is-active': '' } : null) } */ stateAttributesMapping?: StateAttributesMapping; /** * Props to be spread on the rendered element. * They are merged with the internal props of the component, so that event handlers * are merged, `className` strings and `style` properties are joined, while other external props overwrite the * internal ones. */ props?: Record; /** * If `false`, the hook will skip most of its internal logic and return `null`. * This is useful for rendering a component conditionally. * @default true */ enabled?: Enabled; /** * The default tag name to use for the rendered element when `render` is not provided. * @default 'div' */ defaultTagName?: keyof React.JSX.IntrinsicElements; } export type UseRenderReturnValue = Enabled extends false ? null : React.ReactElement; export declare namespace useRender { type RenderProp> = UseRenderRenderProp; type ElementProps = UseRenderElementProps; type ComponentProps = UseRenderComponentProps; type Parameters = UseRenderParameters; type ReturnValue = UseRenderReturnValue; }