import * as React from 'react'; import type { ComponentRenderFn, HTMLProps } from "./types.js"; import { StateAttributesMapping } from "./getStateAttributesProps.js"; type IntrinsicTagName = keyof React.JSX.IntrinsicElements; /** * Renders a Base UI element. * * @param element The default HTML element to render. Can be overridden by the `render` prop. * @param componentProps An object containing the `render` and `className` props to be used for element customization. Other props are ignored. * @param params Additional parameters for rendering the element. */ export declare function useRenderElement, RenderedElementType extends Element, TagName extends IntrinsicTagName | undefined, Enabled extends boolean | undefined = undefined>(element: TagName, componentProps: useRenderElement.ComponentProps, params?: useRenderElement.Parameters): Enabled extends false ? null : React.ReactElement>; type RenderFunctionProps = TagName extends keyof React.JSX.IntrinsicElements ? React.JSX.IntrinsicElements[TagName] : React.HTMLAttributes; export type UseRenderElementParameters = { /** * 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; /** * @deprecated */ propGetter?: (externalProps: HTMLProps) => HTMLProps; /** * The ref to apply to the rendered element. */ ref?: React.Ref | (React.Ref | undefined)[]; /** * The state of the component. */ state?: State; /** * Intrinsic props to be spread on the rendered element. */ props?: RenderFunctionProps | Array | undefined | ((props: RenderFunctionProps) => RenderFunctionProps)>; /** * A mapping of state to `data-*` attributes. */ stateAttributesMapping?: StateAttributesMapping; }; export interface UseRenderElementComponentProps { /** * The class name to apply to the rendered element. * Can be a string or a function that accepts the state and returns a string. */ className?: string | ((state: State) => string | undefined); /** * The render prop or React element to override the default element. */ render?: undefined | ComponentRenderFn, State> | React.ReactElement>; /** * The style to apply to the rendered element. * Can be a style object or a function that accepts the state and returns a style object. */ style?: React.CSSProperties | ((state: State) => React.CSSProperties | undefined); } export declare namespace useRenderElement { type Parameters = UseRenderElementParameters; type ComponentProps = UseRenderElementComponentProps; } export {};