UNPKG

@tempots/ui

Version:

Provides a higher level of renderables to help fast development with Tempo.

39 lines (38 loc) 1.33 kB
import { TNode, Value, Renderable } from '@tempots/dom'; import { HandleAnchorClickOptions } from '../dom/handle-anchor-click'; import { Merge } from '@tempots/std'; /** * Options for configuring an anchor element. * @public */ export type AnchorOptions = Merge<{ /** * The href attribute of the anchor element. * Can be a string or a Signal containing a string. */ href: Value<string>; /** * Whether to use a view transition when navigating to the anchor. */ withViewTransition?: boolean; }, HandleAnchorClickOptions>; /** * Represents either a string value (or Signal of string) for the href, * or a full AnchorOptions object. * * This type is used as the first parameter of the Anchor function, * allowing for flexible configuration of anchor elements. * * @public */ export type HrefOrAnchorOptions = Value<string> | AnchorOptions; /** * Creates an anchor element with the specified href and children. * When the anchor element is clicked, the location is updated to the specified href. * * @param hrefOrOptions - The href attribute of the anchor element. * @param children - The child elements of the anchor element. * @returns The anchor element. * @public */ export declare const Anchor: (hrefOrOptions: HrefOrAnchorOptions, ...children: TNode[]) => Renderable;