The ILabIcon interface. Outside of this interface the actual implementation of LabIcon may vary

Implements

Constructors

Properties

_className: string
_loading: boolean
_props: LabIcon.IProps = {}
_svgElement: undefined | null | HTMLElement = undefined

Cache for svg parsing intermediates

  • undefined: the cache has not yet been populated
  • null: a valid, but empty, value
_svgInnerHTML: undefined | null | string = undefined
_svgReactAttrs: any = undefined
_svgReplaced: Signal<LabIcon, void> = ...
_svgstr: string
_uuid: string
name: string

The name of the icon. By convention, the icon name will be namespaced as so:

"pkg-name:icon-name"
react: IReact

A React component that will create the icon.

Param: className

a string that will be used as the class of the container element. Overrides any existing class

Param: container

a preexisting DOM element that will be used as the container for the svg element

Param: label

text that will be displayed adjacent to the icon

Param: title

a tooltip for the icon

Param: tag

if container is not explicitly provided, this tag will be used when creating the container

Param: stylesheet

optional string naming a builtin icon stylesheet, for example 'menuItem' or statusBar. Can also be an object defining a custom icon stylesheet, or a list of builtin stylesheet names and/or custom stylesheet objects. If array, the given stylesheets will be merged.

See @jupyterlab/ui-components/src/style/icon.ts for details

Param: elementPosition

optional position for the inner svg element

Param: elementSize

optional size for the inner svg element. Set to 'normal' to get a standard 16px x 16px icon

Param: ...elementCSS

all additional args are treated as overrides for the CSS props applied to the inner svg element

Param: ref

forwarded to the ref prop of the icon's svg element

_debug: boolean = false
_instances: Map<string, LabIcon> = ...

Accessors

Methods

  • Resolve an icon name or a {name, svgstr} pair into a DOM element. If icon arg is undefined, the function will fall back to trying to render the icon as a CSS background image, via the iconClass arg. If both icon and iconClass are undefined, this function will return an empty div.

    Parameters

    Returns HTMLElement

    a DOM node with the resolved icon rendered into it

  • Resolve an icon name or a {name, svgstr} pair into a React component. If icon arg is undefined, the function will fall back to trying to render the icon as a CSS background image, via the iconClass arg. If both icon and iconClass are undefined, the returned component will simply render an empty div.

    Parameters

    Returns Element

    a React component that will render the resolved icon