Skip to content

UrlComponent

A component that displays and edits an url.

You can add this component using SettingEx.addUrl.

In order to add the styles for the component, use initPluginContext in your plugin’s onload() function.

Alternatively, you can copy styles from https://unpkg.com/@mnaoumov/obsidian-lib/dist/styles.css.

Import:

import { UrlComponent } from '@mnaoumov/obsidian-lib/setting-components/url-component';

Signature:

export class UrlComponent extends TypedTextComponent<string> implements TextBasedComponent<string>

Extends: TypedTextComponent<string>

Implements: TextBasedComponent<string>

Constructor

new UrlComponent(containerEl: HTMLElement)

Creates a new Url component.

Properties

PropertyTypeDescription
empty() => voidEmpties the component.
(Inherited from TextBasedComponent)
inputElHTMLInputElementAn input element of the component.
(Inherited from TypedTextComponent)
isEmpty() => booleanChecks if the component is empty.
(Inherited from TextBasedComponent)
onChange(callback: (newValue: string) => void) => thisSets a callback function to be called when the value of the component changes.
(Inherited from TypedTextComponent)
setPlaceholderValue(placeholderValue: string) => thisSets the placeholder value of the component.
(Inherited from TextBasedComponent)
textComponentTextComponentThe inner text component.
(Inherited from TypedTextComponent)
validatorElValidatorElementA validator element of the component.
(Inherited from TypedTextComponent)

Methods

MethodReturnsDescription
empty()voidEmpties the component.
getValue()stringGets the value of the component.
(Inherited from TypedTextComponent)
isEmpty()booleanChecks if the component is empty.
onChange(callback)thisSets the callback function to be called when the component is changed.
(Inherited from TypedTextComponent)
onChanged()voidCalled when the component is changed.
(Inherited from TypedTextComponent)
setDisabled(isDisabled)thisSets the disabled state of the component.
(Inherited from TypedTextComponent)
setPlaceholderValue(placeholderValue)thisSets the placeholder value of the component.
setValue(value)thisSets the value of the component.
(Inherited from TypedTextComponent)
valueFromString($string)stringConverts a string to an url.
valueToString(value)stringConverts a value to a string.
(Inherited from TypedTextComponent)

Links to this page: