RazorWire JavaScript API
RazorWire JavaScript API
Public JavaScript contracts harvested from documented source comments.
window.RazorWire
SourceBrowser global that exposes RazorWire runtime managers and runtime configuration for diagnostics and advanced integrations.
window.RazorWirewindow.RazorWireIslandModules
SourceOptional island module manifest that maps logical `data-rw-module` names to host-provided module specifiers before RazorWire imports them.
window.RazorWireIslandModules- Type: {Record<string, string>}
- Source: host page script or bundled app script
Properties
moduleNamestring - Logical island module name keyed by the value rendered in `data-rw-module`.
window.RazorWire.config
SourceRuntime configuration merged from the `<rw:scripts />` script tag.
window.RazorWire.config- Type: {object}
- Source: <rw:scripts />
Properties
developmentDiagnosticsboolean - Whether development diagnostics can be exposed.failureUxEnabledboolean - Whether failed-form request markers, events, fallback rendering, and diagnostics are enabled.failureMode"auto"|"manual"|"off" - Default failed-form behavior.defaultFailureMessagestring - Reader-facing fallback copy for unhandled form failures.formLoadingEnabledboolean - C# `Forms.Loading.Enabled`, serialized as `data-rw-form-loading-enabled`; defaults to `true`.formLoadingShowFallbackBarboolean - C# `Forms.Loading.ShowFallbackBar`, serialized as `data-rw-form-loading-show-fallback-bar`; defaults to `true`.formLoadingPreventDuplicateSubmissionsboolean - C# `Forms.Loading.PreventDuplicateSubmissions`, serialized as `data-rw-form-loading-prevent-duplicate-submissions`; defaults to `true`.
RazorWireBehaviorDefinition
SourceBehavior definition registered with the RazorWire Behavior Kit.
RazorWireBehaviorDefinitionProperties
namestring - Stable behavior name. Names are immutable for the page lifetime; repeated registrations with the same selector are idempotent.selectorstring - CSS selector for roots that should receive one connected behavior controller.connectFunction - Callback invoked once per matching connected root. It receives `(root, context)` and may return a cleanup function.
RazorWireLifecycleDefinition
SourcePage-lifecycle definition registered with the RazorWire Behavior Kit.
RazorWireLifecycleDefinitionProperties
namestring - Stable lifecycle behavior name. Names are immutable for the page lifetime; repeated registrations with the same lifecycle options are idempotent.[events]Array<"initial"|"turbo:load"|"turbo:render"> - Logical page lifecycle events that should run the behavior. Defaults to `["initial", "turbo:load"]`.[frames]boolean - Set to `true` to run on `turbo:frame-load`; frame loads are ignored by default.connectFunction - Callback invoked for each matching lifecycle pass. It receives `context` and may return a cleanup function.
RazorWireBehaviorDiagnostic
SourceDiagnostic emitted by the RazorWire Behavior Kit.
RazorWireBehaviorDiagnosticProperties
codeRazorWireBehaviorDiagnosticCode - Stable diagnostic code.Type preview: RazorWireBehaviorDiagnosticCode - Stable Behavior Kit diagnostic codes.
messagestring - Required problem statement for the invalid registration or lifecycle failure.impactstring - Required explanation of the behavior RazorWire skipped, changed, or could not guarantee.fixstring - Required remediation guidance suitable for docs, tests, and development diagnostics.docsstring - Required repository documentation path for troubleshooting guidance.[behaviorName]string - Behavior name associated with the diagnostic when available.[rootId]string - Runtime-generated behavior/root identity when available.
window.RazorWire.behaviors
SourceBehavior Kit manager for app-authored progressive enhancement on replaceable server-rendered DOM and logical browser visits.
window.RazorWire.behaviors- Type: {object}
- Source: <rw:scripts behavior-kit="true" />
Properties
registerFunction - Registers a root-scoped behavior definition with `name`, `selector`, and `connect(root, context)`.registerLifecycleFunction - Registers a page-lifecycle behavior definition with `name`, optional `events`, optional `frames`, and `connect(context)`.scanFunction - Re-scans the document or supplied root for registered behavior selectors.pruneFunction - Disconnects controllers whose roots left the document or no longer match their selector.getDiagnosticsFunction - Returns stable Behavior Kit diagnostics recorded since startup.clearDiagnosticsFunction - Clears recorded Behavior Kit diagnostics.
RazorWireBehaviorContext
SourceRoot-scoped Behavior Kit context passed to `window.RazorWire.behaviors.register(...).connect`.
RazorWireBehaviorContextProperties
signalAbortSignal - Signal aborted before cleanup when RazorWire disconnects the root.behaviorNamestring - Registered behavior name.rootIdstring - Stable runtime identity for the current behavior/root pair.queryFunction - Scoped `querySelector` helper rooted at the connected element.queryAllFunction - Scoped `querySelectorAll` helper rooted at the connected element.diagnosticFunction - Records an app-owned behavior diagnostic with a message and fix.
RazorWireLifecycleContext
SourcePage-lifecycle Behavior Kit context passed to `window.RazorWire.behaviors.registerLifecycle(...).connect`.
RazorWireLifecycleContextProperties
signalAbortSignal - Signal aborted before cleanup when the lifecycle behavior reconnects on a later pass.behaviorNamestring - Registered lifecycle behavior name.urlstring - Current browser URL for the lifecycle pass.renderKind"initial"|"turbo:load"|"turbo:render"|"turbo:frame-load" - Logical render lifecycle that triggered the pass.rootDocument|Element - Document or frame element that owns the lifecycle pass.diagnosticFunction - Records an app-owned lifecycle diagnostic with a message and fix.
RazorWireBehaviorDiagnosticCode
SourceStable Behavior Kit diagnostic codes.
RazorWireBehaviorDiagnosticCodewindow.RazorWire.sectionCopyManager
SourceSingleton section-copy manager for framework-neutral section permalink buttons, generated copy controls, clipboard fallback UI, and lifecycle-safe rebinding.
Singleton section-copy manager for framework-neutral section permalink buttons, generated copy controls, clipboard fallback UI, and lifecycle-safe rebinding. Consumers use `window.RazorWire.sectionCopyManager`; do not construct `SectionCopyManager`.
window.RazorWire.sectionCopyManager- Type: {SectionCopyManager}
- Source: <rw:scripts /> with rendered `[data-rw-section-copy]` or `[data-rw-section-copy-target]` markup
Type preview: SectionCopyManager - Declaration-only object shape for the section-copy manager singleton.
scanFunction - Re-scans the document for section-copy roots and markers after custom DOM updates.pruneFunction - Removes controllers for disconnected section-copy roots.getDiagnosticsFunction - Returns stable section-copy diagnostics recorded since startup.clearDiagnosticsFunction - Clears recorded section-copy diagnostics.
Properties
scanFunction - Re-scans the document for section-copy roots and markers after custom DOM updates.pruneFunction - Removes controllers for disconnected section-copy roots.getDiagnosticsFunction - Returns stable section-copy diagnostics recorded since startup.clearDiagnosticsFunction - Clears recorded section-copy diagnostics.
SectionCopyManager
SourceDeclaration-only object shape for the section-copy manager singleton.
SectionCopyManagerProperties
scanFunction - Re-scans the document for section-copy roots and markers after custom DOM updates.pruneFunction - Removes controllers for disconnected section-copy roots.getDiagnosticsFunction - Returns stable section-copy diagnostics recorded since startup.clearDiagnosticsFunction - Clears recorded section-copy diagnostics.
RazorWireSectionCopyDiagnostic
SourceDiagnostic returned by the RazorWire section-copy manager.
RazorWireSectionCopyDiagnosticProperties
messagestring - Required reader-facing problem statement for the invalid marker or runtime state.impactstring - Required explanation of the behavior RazorWire skipped, changed, or could not guarantee.fixstring - Required remediation guidance suitable for docs, tests, and development diagnostics.docsstring - Required repository documentation path for the related troubleshooting guidance.
razorwire:form:submit-start
SourceA RazorWire-enhanced form started submitting through Turbo.
razorwire:form:submit-start- Target: form[data-rw-form="true"]
- Fires when: Turbo begins submitting a RazorWire-enhanced form and RazorWire marks it busy.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Submitted form.detail.submitterHTMLElement|null - Button or submit control that initiated the submission.
FormFailureDetail
SourceFailure payload passed through event.detail for a failed RazorWire-enhanced form submission.
FormFailureDetailProperties
formHTMLFormElement - Submitted form.submitterHTMLElement|null - Button or submit control that initiated the submission.statusCodenumber|null - HTTP status code when available.handledboolean - Whether the server response already handled the failure.responseKind"turbo-stream"|"html"|"json"|"unknown"|"network" - Failure category.targetElement - Stream target or form that should own the failure UI.messagestring - Reader-facing fallback message.developmentDiagnosticObject|null - Development diagnostic payload when enabled.
razorwire:form:failure
SourceA RazorWire-enhanced form submission failed and custom UI may handle the failure.
razorwire:form:failure- Target: form[data-rw-form="true"]
- Fires when: Turbo reports a failed form submission or RazorWire catches a network failure.
- Bubbles: true
- Cancelable: true
Detail fields
detailFormFailureDetail - Failure payload.Type preview: FormFailureDetail - Failure payload passed through event.detail for a failed RazorWire-enhanced form submission.
formHTMLFormElement - Submitted form.submitterHTMLElement|null - Button or submit control that initiated the submission.statusCodenumber|null - HTTP status code when available.handledboolean - Whether the server response already handled the failure.responseKind"turbo-stream"|"html"|"json"|"unknown"|"network" - Failure category.- View full FormFailureDetail contract
detail.formHTMLFormElement - Submitted form.detail.submitterHTMLElement|null - Button or submit control that initiated the submission.detail.statusCodenumber|null - HTTP status code when available.detail.handledboolean - Whether the server response already handled the failure.detail.responseKind"turbo-stream"|"html"|"json"|"unknown"|"network" - Failure category.detail.targetElement - Stream target or form that should own the failure UI.detail.messagestring - Reader-facing fallback message.detail.developmentDiagnosticObject|null - Development diagnostic payload when enabled.
razorwire:form:diagnostic
SourceDevelopment diagnostics are available for a failed RazorWire-enhanced form submission.
razorwire:form:diagnostic- Target: form[data-rw-form="true"]
- Fires when: development diagnostics are enabled for a failed RazorWire-enhanced form.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Submitted form.detail.statusCodenumber|null - HTTP status code when available.detail.titlestring - Short diagnostic title.detail.detailstring - Diagnostic explanation.detail.docsHrefstring - Documentation link target.detail.hintsstring[] - Suggested fixes.
razorwire:form:submit-end
SourceA RazorWire-enhanced form finished submitting.
razorwire:form:submit-end- Target: form[data-rw-form="true"]
- Fires when: Turbo finishes a RazorWire-enhanced form submission or RazorWire handles a fetch error.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Submitted form.detail.submitterHTMLElement|null - Button or submit control that initiated the submission.detail.successboolean - Whether the submission succeeded.detail.statusCodenumber|null - HTTP status code when available.detail.handledboolean - Whether the server response already handled the result.
razorwire:stream:error
SourceA RazorWire stream source reported a native EventSource error.
razorwire:stream:error- Target: rw-stream-source
- Fires when: The browser reports an EventSource error for a registered RazorWire stream source. Native EventSource does not expose HTTP status codes or response bodies to application JavaScript, so use server logs and the Network tab for exact rejection reasons.
- Bubbles: true
- Cancelable: false
Detail fields
detail.channelstring|null - Client-derived channel token for the stream source.detail.sourceElement - Stream source element that observed the error.detail.state"connecting"|"connected"|"disconnected"|string - Last RazorWire stream state before the error callback.detail.readyStatenumber - Native EventSource readyState value.detail.srcstring - Stream source URL.
data-rw-form
SourceEnables RazorWire form failure handling on a form.
data-rw-form- Target: form
- Type: {"true"}
data-rw-loading
SourceEnables RazorWire loading feedback and loading-layer duplicate prevention for an `rw-active` form.
Enables RazorWire loading feedback and loading-layer duplicate prevention for an `rw-active` form. The form Tag Helper emits `data-rw-loading="true"` when global loading is enabled. Set it to `off` to opt out of the whole loading layer for that form; failure handling is independent.
data-rw-loading- Target: form[rw-active]
- Type: {"true"|"off"}
- Default: true
data-rw-loading-lock
SourceOverrides the global duplicate-submission setting for one enabled loading form.
Overrides the global duplicate-submission setting for one enabled loading form. `false` permits overlapping submissions; `true` keeps the same-form guard active. Other values use the global setting. This browser guard does not provide server-side idempotency, and direct `form.submit()` bypasses it.
data-rw-loading-lock- Target: form[rw-active]
- Type: {"true"|"false"}
- Default: true
data-rw-loading-boundary
SourceDeclares a loading-indicator ownership boundary. The marker is presence-only; any value declares a boundary. An indicator belongs to its nearest boundary, and enabled forms search their ancestor boundaries from nearest outward.
data-rw-loading-boundary- Target: ancestor element containing an enabled form and its indicators
- Type: {presence-only}
data-rw-loading-indicator
SourceMarks app-authored status content that RazorWire may reveal for a pending form.
Marks app-authored status content that RazorWire may reveal for a pending form. Start it hidden and provide visible action text plus status semantics such as `role="status"` and `aria-live="polite"`. RazorWire toggles only the `hidden` state; the app owns the message and presentation.
data-rw-loading-indicator- Target: app-authored element owned by an applicable loading boundary
- Type: {presence-only}
data-rw-loading-state
SourceRuntime state hook set to `pending` on an active form and its selected boundary.
Runtime state hook set to `pending` on an active form and its selected boundary. RazorWire snapshots and restores the previous value. Do not author this state as a control input.
data-rw-loading-state- Target: enabled form or selected loading boundary
- Type: {"pending"}
data-rw-section-copy-root
SourceMarks an optional root that scopes section-copy status, generated buttons, feedback timers, and cleanup.
data-rw-section-copy-root- Target: section, article, main, div
- Type: {"true"}
data-rw-section-copy
SourceMarks a button that copies a section permalink for the referenced target id.
data-rw-section-copy- Target: button
- Type: {string}
data-rw-section-copy-title
SourceProvides reader-facing section title copy for `aria-label`, live status, and fallback dialog labels.
data-rw-section-copy-title- Target: button[data-rw-section-copy], [data-rw-section-copy-target]
- Type: {string}
data-rw-section-copy-status
SourceMarks an optional live status region for section-copy feedback.
data-rw-section-copy-status- Target: span, div
- Type: {"true"}
data-rw-section-copy-target
SourceMarks a heading or section container that should receive a generated plain-text copy button.
data-rw-section-copy-target- Target: h1, h2, h3, h4, h5, h6, header, section, div
- Type: {"true"}
scroll-padding-block
SourceLogical CSS inset contract for active page navigation reveal inside overflowing vertical nav surfaces.
scroll-padding-block- Target: visible vertical scrollable ancestor between `a[data-rw-page-nav-link]` and `[data-rw-page-nav]`
- Hook kind: css-property
- Stability: stable
scroll-padding-top
SourceStart-side CSS inset contract for active page navigation reveal inside overflowing vertical nav surfaces.
scroll-padding-top- Target: visible vertical scrollable ancestor between `a[data-rw-page-nav-link]` and `[data-rw-page-nav]`
- Hook kind: css-property
- Stability: stable
scroll-padding-bottom
SourceEnd-side CSS inset contract for active page navigation reveal inside overflowing vertical nav surfaces.
scroll-padding-bottom- Target: visible vertical scrollable ancestor between `a[data-rw-page-nav-link]` and `[data-rw-page-nav]`
- Hook kind: css-property
- Stability: stable
[data-rw-section-copy-enhanced="true"]
SourceStable selector for roots enhanced by the section-copy runtime.
[data-rw-section-copy-enhanced="true"]- Target: [data-rw-section-copy-root], body
- Hook kind: data-attribute
- Stability: stable
[data-rw-section-copy-inserted="true"]
SourceStable selector for generated section-copy buttons.
[data-rw-section-copy-inserted="true"]- Target: button[data-rw-section-copy]
- Hook kind: data-attribute
- Stability: stable
[data-rw-section-copy-state="copied|fallback"]
SourceStable selector for transient copy feedback state.
[data-rw-section-copy-state="copied|fallback"]- Target: button[data-rw-section-copy]
- Hook kind: data-attribute
- Stability: stable
[data-rw-section-copy-message]
SourceStable selector for generated section-copy feedback text attached to a button.
[data-rw-section-copy-message]- Target: button[data-rw-section-copy]
- Hook kind: data-attribute
- Stability: stable
[data-rw-section-copy-fallback="true"]
SourceStable selector for runtime-generated section-copy clipboard fallback UI.
[data-rw-section-copy-fallback="true"]- Target: generated fallback dialog
- Hook kind: data-attribute
- Stability: stable
[data-rw-section-copy-status-generated="true"]
SourceStable selector for runtime-generated section-copy status regions.
[data-rw-section-copy-status-generated="true"]- Target: generated status region
- Hook kind: data-attribute
- Stability: stable
data-rw-form-failure
SourceSelects how RazorWire renders unhandled form failures.
data-rw-form-failure- Target: form[data-rw-form="true"]
- Type: {"auto"|"manual"|"off"}
- Default: auto
[data-rw-form-error-generated="true"]
SourceStable selector for generated form failure UI.
[data-rw-form-error-generated="true"]- Target: generated form failure UI
- Hook kind: data-attribute
- Stability: stable
[data-rw-loading-fallback]
SourceStable selector for the package-owned form-loading fallback bar.
Stable selector for the package-owned form-loading fallback bar. The fallback is fixed-position and its packaged stylesheet respects the `hidden` state.
[data-rw-loading-fallback]- Target: package-owned form-loading status bar
- Hook kind: data-attribute
- Stability: stable
[data-rw-loading-state="pending"]
SourceStable selector for a form or loading boundary with pending form activity.
[data-rw-loading-state="pending"]- Target: enabled form or selected loading boundary
- Hook kind: data-attribute
- Stability: stable
--rw-ui-accent
SourceControls the accent used by the package form-loading fallback.
--rw-ui-accent- Target: [data-rw-loading-fallback]
- Default: #2563eb
- Syntax: <color>
--rw-loading-fallback-z-index
SourceControls the stacking order of the package form-loading fallback.
--rw-loading-fallback-z-index- Target: [data-rw-loading-fallback]
- Default: 1000
- Syntax: <integer>
--rw-loading-fallback-block-size
SourceControls the main block size of the package form-loading fallback before safe-area padding.
--rw-loading-fallback-block-size- Target: [data-rw-loading-fallback]
- Default: 2.5rem
- Syntax: <length>
--rw-loading-fallback-surface
SourceControls the background of the package form-loading fallback.
--rw-loading-fallback-surface- Target: [data-rw-loading-fallback]
- Default: #fff
- Syntax: <color>
--rw-loading-fallback-color
SourceControls the status text color of the package form-loading fallback.
--rw-loading-fallback-color- Target: [data-rw-loading-fallback]
- Default: #111827
- Syntax: <color>
--rw-loading-fallback-border
SourceControls the bottom border color of the package form-loading fallback.
--rw-loading-fallback-border- Target: [data-rw-loading-fallback]
- Default: rgb(17 24 39 / 18%)
- Syntax: <color>
--rw-loading-fallback-shadow
SourceControls the shadow of the package form-loading fallback.
--rw-loading-fallback-shadow- Target: [data-rw-loading-fallback]
- Default: 0 0.125rem 0.5rem rgb(17 24 39 / 14%)
- Syntax: <shadow>
--rw-loading-fallback-progress-size
SourceControls the thickness of the package form-loading fallback's decorative progress strip.
--rw-loading-fallback-progress-size- Target: [data-rw-loading-fallback]
- Default: 0.1875rem
- Syntax: <length>
--rw-form-error-text
SourceControls generated form failure text color.
--rw-form-error-text- Target: [data-rw-form-error-generated="true"]
- Default: #3f3f46
- Syntax: <color>
mount
SourceIsland modules may export mount to hydrate a server-rendered root.
mount(root, props)- Target: module referenced by data-rw-module
- Signature: mount(root, props)
Parameters
rootHTMLElement - Island root element.propsRecord<string, unknown> - Parsed island props.
data-rw-module
SourceNames the browser module that should hydrate an island root.
data-rw-module- Target: [data-rw-module]
- Type: {string}
window.RazorWire.formInteractionsManager
SourceForm interactions manager for conditional form targets and nested model-bound collection mechanics.
window.RazorWire.formInteractionsManager- Type: {object}
- Source: <rw:scripts /> with rendered `[data-rw-form-toggle]` or `[data-rw-form-collection]` markup
Properties
scanFunction - Re-scans the document for forms containing form-interaction markers after custom DOM updates.pruneFunction - Removes controllers for disconnected forms.getDiagnosticsFunction - Returns stable form-interaction diagnostic objects recorded since startup.getDiagnostics[].messagestring - Required problem statement for invalid form-interaction markup.getDiagnostics[].impactstring - Required explanation of skipped behavior or submit-semantics risk.getDiagnostics[].fixstring - Required remediation guidance.getDiagnostics[].docsstring - Required repository documentation path for troubleshooting.clearDiagnosticsFunction - Clears recorded diagnostics.
data-rw-form-collection-index-token
SourceLocal unresolved row token for a model-bound collection template.
data-rw-form-collection-index-token- Target: [data-rw-form-collection]
- Type: {string}
- Default: __index__
razorwire:form-toggle:before-change
SourceA conditional form toggle is about to reveal or hide its targets.
razorwire:form-toggle:before-change- Target: [data-rw-form-toggle]
- Fires when: A form toggle value changes and RazorWire has resolved the same-form targets that may be shown or hidden.
- Bubbles: true
- Cancelable: true
Detail fields
detail.formHTMLFormElement - Owning form.detail.controlHTMLElement - Toggle control.detail.targetHTMLElement - First matched target.detail.visibleboolean - Whether targets will be shown.
razorwire:form-toggle:change
SourceA conditional form toggle finished revealing or hiding its targets.
razorwire:form-toggle:change- Target: [data-rw-form-toggle]
- Fires when: RazorWire finishes applying visibility, state hooks, and optional disabled state for a conditional form target.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Owning form.detail.controlHTMLElement - Toggle control.detail.targetHTMLElement - First matched target.detail.visibleboolean - Whether targets are shown.
razorwire:form-collection:before-add
SourceA model-bound collection command is about to add a row.
razorwire:form-collection:before-add- Target: [data-rw-form-collection-add]
- Fires when: Add has rebased detached template attributes and allocated an index, before clearing editable values and assigning the final row metadata/marker. Cancellation prevents runtime mutation; ownership, markers, tokens, and IDs are revalidated after listeners return.
- Bubbles: true
- Cancelable: true
Detail fields
detail.formHTMLFormElement - Owning form.detail.rootHTMLElement - Owning collection root, including the child root for a nested command.detail.controlHTMLElement - Command button.detail.rowHTMLElement - Attribute-rebased detached row before Add's value clearing and final marker assignment.detail.indexstring - New sparse model-binding index.detail.action"add" - Collection action.
razorwire:form-collection:add
SourceA model-bound collection command added a row.
razorwire:form-collection:add- Target: [data-rw-form-collection-add]
- Fires when: RazorWire inserts a new collection row and enables its hidden `.index` marker.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Owning form.detail.rootHTMLElement - Collection root.detail.controlHTMLElement - Command button.detail.rowHTMLElement - Inserted row.detail.indexstring - New sparse model-binding index.detail.action"add" - Collection action.
razorwire:form-collection:before-duplicate
SourceA model-bound collection command is about to duplicate a row.
razorwire:form-collection:before-duplicate- Target: [data-rw-form-collection-duplicate]
- Fires when: Duplicate has fully prepared the detached clone, including owned descendant keys, copied live values, cleared identities, and omitted tombstones. Cancellation prevents runtime mutation; live structural preconditions and planned IDs are revalidated after listeners return.
- Bubbles: true
- Cancelable: true
Detail fields
detail.formHTMLFormElement - Owning form.detail.rootHTMLElement - Collection root.detail.controlHTMLElement - Command button.detail.rowHTMLElement - Fully prepared detached clone that will be inserted.detail.previousIndexstring|null - Source row index.detail.indexstring - New sparse model-binding index.detail.action"duplicate" - Collection action.
razorwire:form-collection:duplicate
SourceA model-bound collection command duplicated a row.
razorwire:form-collection:duplicate- Target: [data-rw-form-collection-duplicate]
- Fires when: RazorWire inserts a duplicated collection row with a new sparse model-binding index.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Owning form.detail.rootHTMLElement - Collection root.detail.controlHTMLElement - Command button.detail.rowHTMLElement - Inserted clone.detail.previousIndexstring|null - Source row index.detail.indexstring - New sparse model-binding index.detail.action"duplicate" - Collection action.
razorwire:form-collection:before-remove
SourceA model-bound collection command is about to remove or mark a row.
razorwire:form-collection:before-remove- Target: [data-rw-form-collection-remove]
- Fires when: Remove resolves its owned live row and removal mode, before mutation. Cancellation preserves listener edits; ownership and canonical markers are revalidated after listeners return.
- Bubbles: true
- Cancelable: true
Detail fields
detail.formHTMLFormElement - Owning form.detail.rootHTMLElement - Collection root.detail.controlHTMLElement - Command button.detail.rowHTMLElement - Row that will be removed or marked.detail.action"physical-remove"|"mark-remove" - Remove action.detail.removeMode"physical"|"mark" - Remove mode.detail.indexstring - Existing model-binding index.
razorwire:form-collection:remove
SourceA model-bound collection command removed or marked a row.
razorwire:form-collection:remove- Target: [data-rw-form-collection-remove]
- Fires when: RazorWire finishes physically removing a row or marking it for app-owned deletion. Physical removal dispatches on the connected owning root because the command is detached; detail.control and detail.row still identify the original command and affected row.
- Bubbles: true
- Cancelable: false
Detail fields
detail.formHTMLFormElement - Owning form.detail.rootHTMLElement - Collection root.detail.controlHTMLElement - Command button.detail.rowHTMLElement - Row that was removed or marked.detail.action"physical-remove"|"mark-remove" - Remove action.detail.removeMode"physical"|"mark" - Remove mode.detail.indexstring - Existing model-binding index.
data-rw-form-toggle
SourceMarks a control that reveals or hides conditional form targets inside the same form.
data-rw-form-toggle- Target: input, select, textarea, button
- Type: {string}
data-rw-form-toggle-target
SourceMarks an app-authored target revealed or hidden by a matching form toggle.
data-rw-form-toggle-target- Target: fieldset, section, div
- Type: {string}
data-rw-form-collection
SourceMarks an ASP.NET Core model-bound collection root, scoped to its owning row when nested.
data-rw-form-collection- Target: div, section, fieldset
- Type: {string}
data-rw-form-collection-row
SourceMarks an app-authored collection row.
data-rw-form-collection-row- Target: fieldset, div, tr
- Type: {"true"}
data-rw-form-collection-template
SourceMarks the app-authored row template with owned binding names using its collection's local index token, default `__index__`. Nested templates require an enabled hidden `.index` marker with that token; legacy top-level templates may omit it when a correctly prefixed owned field exists. Display text or unrelated attributes do not satisfy template validation.
data-rw-form-collection-template- Target: template
- Type: {"true"}
data-rw-form-collection-add
SourceMarks a button that adds a row from the collection template.
data-rw-form-collection-add- Target: button
- Type: {"true"}
data-rw-form-collection-duplicate
SourceMarks a button that duplicates the nearest collection row.
data-rw-form-collection-duplicate- Target: button
- Type: {"true"}
data-rw-form-collection-remove
SourceMarks a button that physically removes or marks the nearest collection row.
data-rw-form-collection-remove- Target: button
- Type: {"physical"|"mark"|"true"}
[data-rw-form-interactions-enhanced="true"]
SourceStable selector for forms enhanced by the form-interactions runtime.
[data-rw-form-interactions-enhanced="true"]- Target: form
- Hook kind: data-attribute
- Stability: stable
data-rw-strategy
SourceSelects when an island module hydrates.
data-rw-strategy- Target: [data-rw-module]
- Type: {"load"|"idle"|"visible"|"only"}
- Default: load
data-rw-props
SourceJSON props passed to an island module's mount function.
data-rw-props- Target: [data-rw-module]
- Type: {string}