@tempots/ui
Version:
Provides a higher level of renderables to help fast development with Tempo.
36 lines (35 loc) • 1.28 kB
TypeScript
import { TNode, Value, Renderable } from '@tempots/dom';
import { NavigationOptions } from './router/location';
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>;
} & NavigationOptions, 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;