Skip to content

ARIA Attributes

The ARIA attributes are typed properties on every tag, like the other HTML attributes. They are kept in their own module so they do not crowd the completion list. Open it to use them:

open Partas.Solid.Aria

button (ariaLabel = "Close dialog", ariaControls = "menu-1") { "x" }

The bindings come from Oxpecker.Solid, by Lanayx.

The plugin writes each one under its attribute name, so ariaLabel = "Close" becomes aria-label="Close". role is in the same module.

open Partas.Solid.Aria

[<SolidComponent>]
let DetailsSwitch () =
    let on, setOn = createSignal false

    button (
        role = "switch",
        ariaChecked = string (on ()),
        ariaLabel = "Details",
        onClick = fun _ -> setOn (not (on ()))
    ) {
        if on () then "Details: on" else "Details: off"
    }
export function DetailsSwitch() {
    const patternInput = createSignal(false);
    const on = patternInput[0];
    return <button role="switch"
        aria-checked={toString(on())}
        aria-label="Details"
        onClick={(_arg) => {
            patternInput[1](!on());
        }}>
        {on() ? ("Details: on") : ("Details: off")}
    </button>;
}

Boolean attributes

ariaDisabled, ariaHidden, ariaModal, ariaMultiLine and ariaMultiSelectable are typed bool. The plugin writes them as the strings "true" and "false", so ariaHidden = false becomes aria-hidden="false". This matters because Solid 2 removes an attribute whose value is false, and ARIA reads a missing attribute differently from "false". The other states, such as ariaExpanded and ariaChecked, are typed string: pass "true" or "false".

Attributes

PropertyType
rolestring
ariaActiveDescendantstring
ariaAtomicstring
ariaAutoCompletestring
ariaBrailleLabelstring
ariaBrailleRoleDescriptionstring
ariaBusystring
ariaCheckedstring
ariaColCountU2<int, string>
ariaColIndexU2<int, string>
ariaColSpanU2<int, string>
ariaControlsstring
ariaCurrentstring
ariaDescendantstring
ariaDescribedBystring
ariaDescriptionstring
ariaDetailsstring
ariaDisabledbool
ariaDropeffectstring
ariaErrorMessagestring
ariaExpandedstring
ariaFlowTostring
ariaGrabbedstring
ariaHasPopupstring
ariaHiddenbool
ariaInvalidstring
ariaKeyShortcutsstring
ariaLabelstring
ariaLabelledBystring
ariaLevelU2<float, string>
ariaLivestring
ariaModalbool
ariaMultiLinebool
ariaMultiSelectablebool
ariaOrientationstring
ariaOwnsstring
ariaPlaceholderstring
ariaPosInSetU2<int, string>
ariaPressedstring
ariaReadOnlystring
ariaRelevantstring
ariaRequiredstring
ariaRoleDescriptionstring
ariaRowCountU2<int, string>
ariaRowIndexU2<int, string>
ariaRowSpanU2<float, string>
ariaSelectedstring
ariaSetSizeU2<float, string>
ariaSortstring
ariaValueMaxU2<float, string>
ariaValueMinU2<float, string>
ariaValueNowU2<float, string>
ariaValueTextstring
Edit this page