Element.ariaRowCount is an instance property that reflects the aria-rowcount attribute. Learn how it declares the total number of rows in a table, grid, or treegrid, when it matters for partial DOM tables, and how to get or set it from JavaScript—with five examples and try-it labs.
01
Kind
Instance property
02
Type
String (integer)
03
Meaning
Total row count
04
Reflects
aria-rowcount
05
Status
Baseline widely
06
Used on
Table / grid / treegrid
Fundamentals
Introduction
Assistive technologies need to know how tall a data table or grid is—even when only some rows are rendered in the DOM (virtualized or paged rows).
aria-rowcount declares that total. The DOM property ariaRowCount lets you read and update it from JavaScript.
JavaScript
const el = document.getElementById("semantic-table");
console.log(el.ariaRowCount); // "100"
el.ariaRowCount = "101";
💡
Beginner tip
The value is a string containing an integer (for example "100"), not a Number. Pair it with ariaColCount when you also declare total columns.
Concept
Understanding the Property
MDN: the ariaRowCount property of the Element interface reflects the value of the aria-rowcount attribute, which defines the total number of rows in a table, grid, or treegrid.
Reflected attribute — mirrors aria-rowcount.
Get / set — readable and writable string containing an integer.
Total rows — may be larger than rows currently in the DOM.
Baseline — widely available since October 2023 (MDN).
Foundation
📝 Syntax
JavaScript
ariaRowCount
Value
A string which contains an integer—the total number of rows.
Item
Detail
Type
string (e.g. "100", "101")
Reflects
aria-rowcount
Applies to
table, grid, treegrid (and related patterns)
Often paired with
aria-colcount, aria-rowindex on cells
Pattern
📋 Semantic Table (MDN Shape)
MDN sets aria-rowcount="100" on a table (representing the full data set, not only the visible rows), then updates it to "101" via the property:
let el = document.getElementById("semantic-table");
console.log(el.ariaRowCount); // 100
el.ariaRowCount = "101";
console.log(el.ariaRowCount); // 101
Prefer a real <table> with semantic headers when you can. Use ARIA row counts when you need to describe a larger logical data set than what is currently rendered.
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Read
el.ariaRowCount
Write
el.ariaRowCount = "101"
HTML attribute
aria-rowcount="100"
With columns
Also set aria-colcount when needed
MDN status
Baseline Widely available
Snapshot
🔍 At a Glance
Four facts about Element.ariaRowCount.
Kind
get / set
Instance
Type
string
Integer text
Reflects
aria-rowcount
Attribute
Baseline
widely
Oct 2023+
Hands-On
Examples Gallery
Examples follow MDN Element: ariaRowCount. Labs use a small table so you can safely read and write the property.
📚 Getting Started
Read the reflected value and follow MDN’s table update.
Example 1 — Read ariaRowCount
Log the total row count from a table.
JavaScript
const el = document.getElementById("semantic-table");
console.log(el.ariaRowCount);
// HTML includes: aria-rowcount="100"
Prefer ariaRowCount in script; keep the attribute for HTML markup.
Example 5 — Support Snapshot
Feature-detect and remember when row count helps.
JavaScript
console.log({
supported: "ariaRowCount" in Element.prototype,
tip: "Declare total rows even if not all are in the DOM",
valueType: "string containing an integer",
status: "Baseline Widely available (MDN)"
});
{
"supported": true,
"tip": "Declare total rows even if not all are in the DOM",
"valueType": "string containing an integer",
"status": "Baseline Widely available (MDN)"
}
How It Works
Update ariaRowCount when the logical height of your data set changes (for example rows added or removed in a grid UI).
Applications
🚀 Common Use Cases
Data tables that expose a total row count to AT.
Virtualized grids where only some rows are rendered.
Treegrids and spreadsheet-like widgets with dynamic rows.
Keeping script and markup aligned without manual setAttribute.
Pairing with aria-colcount for full table dimensions.
Under the Hood
🔧 How It Works
1
Table / grid has a logical height
You know the total number of rows in the data set.
Model
2
Set aria-rowcount / ariaRowCount
Expose that total as a string integer on the container.
Declare
3
DOM may show fewer rows
Virtualized UIs still report the full count.
Partial DOM
4
✓
Assistive tech understands size
Users get accurate table/grid dimensions.
Important
📝 Notes
Not Deprecated, Experimental, or Non-standard on MDN (Baseline Widely available).
Value is a string containing an integer for the row count.
Often used with aria-colcount and cell aria-rowindex.
Element.ariaRowCount is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Element.ariaRowCount
String integer — reflects aria-rowcount (total rows in table/grid/treegrid).
BaselineWidely available
Google ChromeSupported (ARIA reflection)
Yes
Microsoft EdgeSupported (ARIA reflection)
Yes
Mozilla FirefoxSupported (ARIA reflection)
Yes
Apple SafariSupported (ARIA reflection)
Yes
OperaFollow Chromium support
Yes
Internet ExplorerNo ariaRowCount IDL — use setAttribute
No
ariaRowCountBaseline
Bottom line: Use ariaRowCount to get/set aria-rowcount. Keep the string count aligned with your logical row set, especially for virtualized tables. Pair with ariaColCount when you also declare total columns.
Wrap Up
Conclusion
ariaRowCount reflects aria-rowcount so tables, grids, and treegrids can declare their total row count as a string integer—even when not every row is in the DOM. Update it from JavaScript when the logical height of your data changes.
Use a string integer that matches the logical row total
Pair with aria-colcount when declaring full size
Prefer semantic <table> markup when possible
Update the count when rows are added or removed
Use row indexes when only a subset of rows is shown
❌ Don’t
Leave a stale count after the grid height changes
Treat the value as a Number type in APIs that expect strings
Invent ARIA tables when a native table is enough
Mismatch visible rows vs declared total without reason
Forget accessible names / captions on complex tables
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about ariaRowCount
Reflected aria-rowcount string for total rows.
5
Core concepts
📄01
Get / set
on Element
Kind
📝02
String integer
total rows
Type
🔍03
Table / grid
treegrid too
Use
✅04
Baseline
widely available
Status
🎯05
Partial DOM
still declare total
Tip
❓ Frequently Asked Questions
It reflects the aria-rowcount attribute as a string containing an integer that defines the total number of rows in a table, grid, or treegrid.
No. MDN marks Element.ariaRowCount as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string containing an integer (for example "100" or "101"), not a Number type.
When the full row set is not all in the DOM at once (for example a virtualized or partially rendered table), so assistive technologies still know the total row count.
aria-rowcount is the total rows; aria-colcount is the total columns. MDN’s example sets both on the same table.
Yes. Reading and writing ariaRowCount updates the reflected aria-rowcount attribute.
Did you know?
MDN’s sample table sets aria-rowcount="100" while only showing a few rows, and uses aria-rowindex on cells (11, 16, 18…) so AT knows where those visible rows sit in the full data set.