@jupyter/web-components
Version:
A component library for building extensions in Jupyter frontends.
66 lines (65 loc) • 1.64 kB
TypeScript
import { FASTElement } from '@microsoft/fast-element';
import { iconStyles as styles } from './icon.styles';
/**
* Icon definition
*/
export interface IconDefinition {
/**
* Icon unique name
*/
name: string;
/**
* Icon SVG as string
*/
svgStr: string;
}
/**
* Icon component
*
* Icon must first be registered: `Icon.register({ name, svgStr });`
*
* Then you can use it with `<jp-icon name="{name}"></jp-icon>` .
*
* To style your icon, you should set `fill` and/or `stroke` attributes to `currentColor`.
* Then the icon will be colored with the active text color.
*/
export declare class Icon extends FASTElement {
private static iconsMap;
private static _defaultIcon;
/**
* Register a new icon.
*
* @param options Icon definition
*/
static register(options: IconDefinition): void;
/**
* Set the default icon.
*
* @param svgStr The SVG string to be used as the default icon.
*/
static setDefaultIcon(svgStr: string): void;
/**
* Default icon
*
* This icon will be displayed if the {@link name} does not match any known
* icon names.
*/
static defaultIcon(): string;
/**
* Name of the icon to display.
*/
name: string;
nameChanged(): void;
/**
* The connected callback for this FASTElement.
* @remarks
* This method is invoked by the platform whenever this FASTElement
* becomes connected to the document.
*/
connectedCallback(): void;
/**
* Get the icon SVG
*/
protected getSvg(): string;
}
export { styles as iconStyles };