j3w1 / RepeaterVue · HTML · React · Astro

J3W1 / DESIGN SYSTEM

Repeater

Repeat native field rows with stable identities and keyboard ordering.

stable · LIGHT DOM · 1.1.0

Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

default

    No contacts added.

    <j3w1-repeater id="example-repeater-default" max="10"><section class="repeater" aria-label="Additional contacts"><ol data-rows=""></ol><template data-row-template=""><li class="repeater-item"><label for="example-repeater-default-contact-name">Contact name</label><input class="repeater-control" id="example-repeater-default-contact-name" name="example-repeater-default-contact" required=""><div class="repeater-actions"><button class="repeater-control" type="button" data-move="-1">Move up</button><button class="repeater-control" type="button" data-move="1">Move down</button><button class="repeater-control" type="button" data-remove="">Remove</button></div></li></template><p data-empty="">No contacts added.</p><button class="repeater-control" type="button" data-add="" data-demo-focus-target="">Add contact</button><p role="status" data-repeater-status=""></p></section></j3w1-repeater>

    Install and register

    Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

    npm install --save-exact @j3w1/ui@1.1.0
    import '@j3w1/ui/tokens.css';
    import '@j3w1/ui/styles/repeater.css';
    import '@j3w1/ui/register/repeater';

    Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

    Vue SFC, React, Astro and plain HTML integration →

    Copy the complete implementation

    npx --package=@j3w1/ui@1.1.0 j3w1-ui copy repeater --out ./vendor/j3w1/repeater

    The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

    Public API

    attributes

    NameType / signatureMeaning
    disabledCustomEventDisable the native controls owned by this instance.
    loadingCustomEventMark the primary control busy and prevent duplicate activation.
    maxCustomEventMaximum rows, default 10; positive integer up to 100.

    properties

    NameType / signatureMeaning
    disabledbooleanDelegates disabled state to native children.
    namestringNative control name; application form keys remain explicit.
    rowIdsstring[]Stable IDs in current source order. Read only.

    methods

    NameType / signatureMeaning
    refresh(): voidReconnect behavior after replacing native child structure.
    focus(options?: FocusOptions): voidFocus the first usable native control.
    add(): string | nullAppend a row when below the configured limit.
    remove(id: string): voidRemove a known row and recover focus.
    move(id: string, direction: number): voidMove a row one position up or down.

    events

    NameType / signatureMeaning
    j3w1-rowsCustomEventRow order or membership changed.

    Dependencies and verification

    Registered components: none. Style dependencies: none.

    Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

    Full implementation manifest, API and token dependency closure

    Canonical specification

    Purpose

    Repeat native fields from trusted inert HTML. Add, remove and reorder preserve row identities. The host supplies fields and handles submission; the component does not execute a schema or provide persistence. A max attribute bounds the number of rows; the supplied example is limited to ten.

    Anatomy

    • rows: Ordered list of independently named field rows.
    • template: Trusted native markup cloned on explicit Add.
    • actions: Add, remove, move up and move down; no drag-only behavior.

    States

    StatePresentationNon-colour channel
    defaultNamed content on the default surface.Native text and structure.
    emptyA muted empty message.Explicit text and retained Add action.
    focus-visibleDashed focus ring.Native keyboard focus position.
    disabledDisabled semantic foreground, background and border at full opacity.Native disabled state blocks activation.

    Keyboard

    • Tab / Shift+Tab: Visit fields and row actions in source order.
    • Enter / Space: Add, remove or move a row. Focus follows the affected row or nearest survivor.

    Accessibility

    Namespace IDs and label/ARIA references for each row. Row identities do not change during reordering. Actions have names and disabled boundary states. Removing a focused row restores focus to a surviving row or Add; announce each explicit operation.

    Portability

    Wrap labels and actions without changing source order. Use logical spacing in RTL. Preserve native target sizes at both densities; only bounded data regions may scroll horizontally. Use equivalent native semantics and approved roles; record any unsupported behavior as a mapping deviation. The host owns application data, persistence, permissions and services.

    Non-examples

    Unlabelled controls, color-only status, drag-only operations, hidden required instructions, stolen focus or an invented service success.

    j3w1 / command

    • SPEC Overview
    • SPEC Foundations
    • SPEC Components
    • SPEC Patterns
    • SPEC Tokens
    • SPEC Tools
    • SPEC Implement
    • SPEC For agents
    • SPEC Ports
    • SPEC Releases
    • DEMO Vue application demo
    • SPEC Complete UI theme specification