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

Hierarchy

  • LabIcon

Implements

Constructors


  • members *


    Parameters

    Returns LabIcon

Properties

_className: string
_loading: boolean
_props: LabIcon.IProps
_svgElement: HTMLElement

Cache for svg parsing intermediates

  • undefined: the cache has not yet been populated
  • null: a valid, but empty, value
_svgInnerHTML: string
_svgReactAttrs: any
_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

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

Param

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

Param

text that will be displayed adjacent to the icon

Param

a tooltip for the icon

Param

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

Param

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

optional position for the inner svg element

Param

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

Param

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

Param

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

_debug: any
_instances: any

Accessors

  • get svgElement(): HTMLElement
  • Returns HTMLElement

  • get svgInnerHTML(): string
  • Returns string

  • get svgReactAttrs(): any
  • Returns any

  • get svgstr(): string
  • A string containing the raw contents of an svg file.

    Returns string

  • set svgstr(svgstr): void
  • A string containing the raw contents of an svg file.

    Parameters

    • svgstr: string

    Returns void

Methods

  • Parameters

    • displayName: string

    Returns ForwardRefExoticComponent<LabIcon.IProps & RefAttributes<SVGElement>>

  • Parameters

    Returns void

  • Parameters

    • Optional __namedParameters: {
          title?: string;
          uuid?: string;
      }
      • Optional title?: string
      • Optional uuid?: string

    Returns HTMLElement

  • Get a view of this icon that is bound to the specified icon/style props

    Parameters

    Returns LabIcon

    a view of this LabIcon instance

  • Create an icon as a DOM element

    Parameters

    Returns HTMLElement

    A DOM element that contains an (inline) svg element that displays an icon

  • Customize how a DOM node is rendered. If .renderer is set on a given instance of VirtualElement, this function will be called every time that VirtualElement is rendered.

    Parameters

    • container: HTMLElement

      The actual DOM node created for a VirtualElement during rendering.

      On render, host is created and its attrs are set/updated via the standard routines in updateContent. host is then handed off to this function.

      The render function is free to modify host. The only restriction is is that render should not modify any attributes set by external routines (ie updateContent), as this may cause thrashing when the virtual element is next rendered.

    • Optional options: LabIcon.IRendererOptions

      Will be populated with the .attrs and .children fields set on the VirtualElement being rendered.

    Returns void

  • Optional cleanup function for custom renderers. If the .renderer field of a VirtualELement is set, and if .renderer.unrender is defined, when the element is changed or removed its corresponding DOM element will be passed to this function immediately before it is removed from the DOM.

    unrender is not required for for simple renderers, such as those implemented using document.createElement(). However, for certain rendering techniques explicit cleanup is required in order to avoid resource leaks.

    For example, if render calls ReactDOM.render(..., host), then there has to also be a corresponding implementation of unrender that calls ReactDOM.unmountComponentAtNode(host) in order to prevent a memory leak.

    Parameters

    • container: HTMLElement

      the DOM element to be removed.

    • Optional options: LabIcon.IRendererOptions

      Will be populated with the .attrs and .children fields set on the VirtualElement being unrendered.

    Returns void

  • Remove any rendered icon from the element that contains it

    Parameters

    • container: HTMLElement

      a DOM node into which an icon was previously rendered

    Returns HTMLElement

    the cleaned container

  • Resolve an icon name or a {name, svgstr} pair into an actual LabIcon.

    Parameters

    Returns LabIcon

    a LabIcon instance

  • 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

  • Resolve a {name, svgstr} pair into an actual svg node.

    Parameters

    Returns HTMLElement

  • Toggle icon debug from off-to-on, or vice-versa.

    Parameters

    • Optional debug: boolean

      optional boolean to force debug on or off

    Returns void

Generated using TypeDoc