UNPKG

@opentui/solid

Version:
42 lines (41 loc) 1.68 kB
import { type DomNode } from "../reconciler.js"; import type { JSX } from "../../jsx-runtime"; import type { ValidComponent, ComponentProps } from "solid-js"; /** * Renders components somewhere else in the DOM * * Useful for inserting modals and tooltips outside of an cropping layout. If no mount point is given, the portal is inserted on the root renderable; it is wrapped in a `<box>` * * @description https://docs.solidjs.com/reference/components/portal */ export declare function Portal(props: { mount?: DomNode; ref?: (el: {}) => void; children: JSX.Element; }): DomNode; export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = { [K in keyof P]: P[K]; } & { component: T | undefined; }; /** * Renders an arbitrary component or element with the given props * * This is a lower level version of the `Dynamic` component, useful for * performance optimizations in libraries. Do not use this unless you know * what you are doing. * ```typescript * const element = () => multiline() ? 'textarea' : 'input'; * createDynamic(element, { value: value() }); * ``` * @description https://docs.solidjs.com/reference/components/dynamic */ export declare function createDynamic<T extends ValidComponent>(component: () => T | undefined, props: ComponentProps<T>): JSX.Element; /** * Renders an arbitrary custom or native component and passes the other props * ```typescript * <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} /> * ``` * @description https://docs.solidjs.com/reference/components/dynamic */ export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;