carbon-components-svelte
Version:
Svelte implementation of the Carbon Design System
62 lines (51 loc) • 1.39 kB
TypeScript
import { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";
type $RestProps = SvelteHTMLElements["a"];
type $Props<Icon = any> = {
/**
* Specify the `href` attribute.
* @default undefined
*/
href?: string;
/**
* Specify the text.
* @default undefined
*/
text?: string;
/**
* Specify an icon to render after the text.
* Alternatively, use the "icon" slot.
* @default undefined
*/
icon?: Icon;
/**
* Set to `true` to select the item
* @default false
*/
isSelected?: boolean;
/**
* Obtain a reference to the HTML anchor element.
* @default null
*/
ref?: null | HTMLAnchorElement;
children?: (this: void) => void;
[key: `data-${string}`]: unknown;
};
export type HeaderNavItemProps<Icon = any> = Omit<$RestProps, keyof $Props<Icon>> & $Props<Icon>;
export default class HeaderNavItem<Icon = any> extends SvelteComponentTyped<
HeaderNavItemProps<Icon>,
{
blur: WindowEventMap["blur"];
click: WindowEventMap["click"];
focus: WindowEventMap["focus"];
keydown: WindowEventMap["keydown"];
keyup: WindowEventMap["keyup"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
mouseover: WindowEventMap["mouseover"];
},
{
default: Record<string, never>;
icon: Record<string, never>;
}
> {}