DOM props and forms

aria-* attributes

Supply accessibility information using the actual hyphenated ARIA attribute names. Use native HTML semantics first, and keep ARIA states consistent with real behavior. ARIA does not add keyboard handling by itself.

Formal Syntax & Structure

react syntaxreact
aria-pressed={selected}

Working Example

Example Snippetreact
import { useState } from 'react';export default function App() { const [selected,setSelected] = useState(false); return <button type='button' aria-pressed={selected} onClick={() => setSelected(s => !s)}>Favorite</button>; }
React Reference