Divider¶
A horizontal rule with an optional label in the middle, with role="separator".
Decision¶
| When | Use |
|---|---|
| Splitting two alternatives, such as "Or", or two parts of a form | Divider |
| Naming a group of fields | Subsection Title |
Usage¶
import { createDivider } from './configurationpage?name=myplugin_stolon.js';
container.appendChild(createDivider({ label: 'Or' }).element);
Class: stolon-divider, with the part stolon-divider-label. The handle is { element, getValue, setValue, destroy }, and getValue() returns the label and setValue(label) replaces it.
States and Modifiers¶
- With no label it draws one line.
stolon-divider-plainis that line.
Reference¶
Generated from the code by scripts/build-docs.mjs. Edit the code, not this section.
createDivider¶
function createDivider(options?: DividerOptions): DividerHandle
A horizontal rule with an optional label in the middle, with role separator.
| Option | Type | What it does |
|---|---|---|
label |
string |
| Handle member | Type |
|---|---|
getValue |
(): string |
setValue |
(label: string): void |
destroy |
(): void |
| Class | What it looks like |
|---|---|
stolon-divider |
Horizontal rule with an optional centered label |
Example¶
Example Code¶
<!-- title: Divider -->
<div id="mount"></div>
<script type="module">
const base = await window.__baseReady;
const view = document.getElementById('view');
const mount = document.getElementById('mount');
mount.appendChild(base.createDivider({ label: 'Or' }).element);
mount.appendChild(base.createDivider().element);
</script>