Options
All
  • Public
  • Public/Protected
  • All
Menu

A namespace for LabIcon statics.

Hierarchy

  • LabIcon

Implements

  • ILabIcon
  • { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) }

Index

Type aliases

Static IMaybeResolvable

IMaybeResolvable: IResolvable | VirtualElement.IRenderer | undefined

A type that maybe can be resolved to a LabIcon instance.

Static IReact

IReact: ForwardRefExoticComponent<IReactProps>

The complete type of the React component stored in the .react field of a LabIcon.

Static IReactProps

IReactProps: IProps & RefAttributes<SVGElement>

The properties that can be passed into the React component stored in the .react field of a LabIcon.

Static IReactRef

IReactRef: RefObject<SVGElement>

The type of the svg node ref that can be passed into icon React components

Static IResolvable

IResolvable: string | (IIcon & {})

A type that can be resolved to a LabIcon instance.

Constructors

constructor

  • new LabIcon(__namedParameters: { _loading: boolean; name: string; render: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void); svgstr: string; unrender: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) }): LabIcon

  • members *

    Parameters

    • __namedParameters: { _loading: boolean; name: string; render: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void); svgstr: string; unrender: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) }
      • _loading: boolean
      • name: string
      • render: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void)
      • svgstr: string
      • unrender: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void)

    Returns LabIcon

Properties

Protected _className

_className: string

Protected _loading

_loading: boolean

Protected _props

_props: IProps

Protected _svgElement

_svgElement: HTMLElement | null | undefined = undefined

Cache for svg parsing intermediates

  • undefined: the cache has not yet been populated
  • null: a valid, but empty, value

Protected _svgInnerHTML

_svgInnerHTML: string | null | undefined = undefined

Protected _svgReactAttrs

_svgReactAttrs: any | null | undefined = undefined

Protected _svgReplaced

_svgReplaced: Signal<this, void> = new Signal<this, void>(this)

Protected _svgstr

_svgstr: string

Protected _uuid

_uuid: string

name

name: string

react

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

Static Private _debug

_debug: boolean = false

Static Private _instances

_instances: Map<string, LabIcon> = new Map<string, LabIcon>()

Accessors

Protected svgElement

  • get svgElement(): HTMLElement | null

Protected svgInnerHTML

  • get svgInnerHTML(): string | null

Protected svgReactAttrs

  • get svgReactAttrs(): any | null

svgstr

  • get svgstr(): string
  • set svgstr(svgstr: string): void

Methods

Protected _initReact

  • _initReact(displayName: string): ForwardRefExoticComponent<IProps & RefAttributes<SVGElement>>

Protected _initRender

  • _initRender(__namedParameters: { render: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void); unrender: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) }): void
  • Parameters

    • __namedParameters: { render: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void); unrender: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) }
      • render: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void)
      • unrender: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void)

    Returns void

Protected _initSvg

  • _initSvg(__namedParameters?: { title: undefined | string; uuid: undefined | string }): HTMLElement | null
  • Parameters

    • Default value __namedParameters: { title: undefined | string; uuid: undefined | string } = {}
      • title: undefined | string
      • uuid: undefined | string

    Returns HTMLElement | null

bindprops

  • bindprops(props?: IProps): any

element

  • element(props?: IProps): HTMLElement

render

Optional unrender

Static remove

  • remove(container: HTMLElement): HTMLElement
  • 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

Static resolve

  • resolve(__namedParameters: { icon: string | (IIcon & {}) }): LabIcon
  • Resolve an icon name or a {name, svgstr} pair into an actual LabIcon.

    Parameters

    • __namedParameters: { icon: string | (IIcon & {}) }
      • icon: string | (IIcon & {})

        either a string with the name of an existing icon or an object with {name: string, svgstr: string} fields.

    Returns LabIcon

    a LabIcon instance

Static resolveElement

  • resolveElement(__namedParameters: { fallback: undefined | LabIcon; icon: undefined | string | { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) } | (IIcon & {}); iconClass: undefined | string; props: props }): HTMLElement
  • 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.

    deprecated

    fallback - don't use, optional, a LabIcon instance that will be used if neither icon nor iconClass are defined

    Parameters

    • __namedParameters: { fallback: undefined | LabIcon; icon: undefined | string | { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) } | (IIcon & {}); iconClass: undefined | string; props: props }
      • fallback: undefined | LabIcon
      • icon: undefined | string | { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) } | (IIcon & {})

        optional, either a string with the name of an existing icon or an object with {name: string, svgstr: string} fields

      • iconClass: undefined | string

        optional, if the icon arg is not set, the iconClass arg should be a CSS class associated with an existing CSS background-image

      • props: props

        any additional args are passed though to the element method of the resolved icon on render

    Returns HTMLElement

    a DOM node with the resolved icon rendered into it

Static resolveReact

  • resolveReact(__namedParameters: { fallback: undefined | LabIcon; icon: undefined | string | { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) } | (IIcon & {}); iconClass: undefined | string; props: props }): Element
  • 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.

    deprecated

    fallback - don't use, optional, a LabIcon instance that will be used if neither icon nor iconClass are defined

    Parameters

    • __namedParameters: { fallback: undefined | LabIcon; icon: undefined | string | { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) } | (IIcon & {}); iconClass: undefined | string; props: props }
      • fallback: undefined | LabIcon
      • icon: undefined | string | { render: (host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void; unrender?: undefined | ((host: HTMLElement, options?: undefined | { attrs?: ElementAttrs; children?: ReadonlyArray<VirtualNode> }) => void) } | (IIcon & {})

        optional, either a string with the name of an existing icon or an object with {name: string, svgstr: string} fields

      • iconClass: undefined | string

        optional, if the icon arg is not set, the iconClass arg should be a CSS class associated with an existing CSS background-image

      • props: props

        any additional args are passed though to the React component of the resolved icon on render

    Returns Element

    a React component that will render the resolved icon

Static resolveSvg

  • resolveSvg(__namedParameters: { name: string; svgstr: string }): HTMLElement | null

Static toggleDebug

  • toggleDebug(debug?: undefined | false | true): void

Generated using TypeDoc