A React-based HTML reporter for axe-core accessibility testing results. This component provides a beautiful and interactive way to display accessibility test results, including passed and failed checks, with detailed information about each issue.
npm install axe-html-reporter
# or
yarn add axe-html-reporter
import React from 'react';
import AxeReport from 'axe-html-reporter';
function App() {
// Example axe-core results
const axeResults = {
passes: [
{
id: "color-contrast",
impact: "serious",
tags: ["wcag2aa", "wcag143"],
description: "Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds",
help: "Elements must have sufficient color contrast",
helpUrl: "https://dequeuniversity.com/rules/axe/4.4/color-contrast",
nodes: []
}
],
violations: [
{
id: "image-alt",
impact: "critical",
tags: ["wcag2a", "wcag111", "section508", "section508.22.a"],
description: "Ensures
elements have alternate text or a role of none or presentation",
help: "Images must have alternate text",
helpUrl: "https://dequeuniversity.com/rules/axe/4.4/image-alt",
nodes: []
}
]
};
return (
);
}
The main component that displays the complete accessibility report.
data
(Object): The axe-core results object containing passes
and violations
arraysinfo1
(string): Additional information to display in the headerinfo2
(string): Additional information to display in the headerA circular gauge component that displays the overall accessibility score.
percentage
(number): The percentage value to display (0-100)size
(number): The size of the gauge in pixelsstrokeWidth
(number): The width of the gauge's strokecolor
(string): The color of the progress indicatorbackgroundColor
(string): The color of the background tracktextColor
(string): The color of the percentage texttextSize
(number): The size of the percentage textA collapsible section component that displays a list of accessibility check results.
title
(string): The title of the sectiondata
(Array): Array of accessibility check resultsA component that displays detailed information about a single accessibility rule check.
rule
(Object): The accessibility rule data objectA table component that displays a summary of accessibility rule violations.
data
(Array): Array of accessibility rule violationsA table component that displays detailed information about nodes affected by an accessibility rule.
nodes
(Array): Array of DOM nodes affected by the ruleThe component uses CSS modules for styling. You can customize the appearance by overriding the CSS classes in your own stylesheet.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.