svgTitles
Reports <svg> elements without a <title> child element.
✅ This rule is included in the jsxlogicalandlogicalStrictpresets.
SVG elements should include a <title> child element to provide accessible descriptions for screen readers.
Without a title, users who rely on assistive technologies cannot understand the purpose or content of the SVG.
The <title> element provides descriptive text that screen readers can announce.
Alternatively, you can use aria-label or aria-labelledby attributes for accessibility.
This is required for WCAG 1.1.1 compliance.
Examples
Section titled “Examples”<JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg /><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg SVGAttributes<SVGSVGElement>.viewBox?: string | undefined
viewBox="0 0 100 100" /><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg> <JSX.IntrinsicElements.circle: SVGProps<SVGCircleElement>
circle SVGAttributes<SVGCircleElement>.cx?: string | number | undefined
cx="50" SVGAttributes<SVGCircleElement>.cy?: string | number | undefined
cy="50" SVGAttributes<SVGCircleElement>.r?: string | number | undefined
r="40" /></JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg> <JSX.IntrinsicElements.desc: SVGProps<SVGDescElement>
desc>Description only</JSX.IntrinsicElements.desc: SVGProps<SVGDescElement>
desc></JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg> <JSX.IntrinsicElements.title: DetailedHTMLProps<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>
title>Accessible title</JSX.IntrinsicElements.title: DetailedHTMLProps<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>
title></JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg> <JSX.IntrinsicElements.title: DetailedHTMLProps<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>
title>Circle</JSX.IntrinsicElements.title: DetailedHTMLProps<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>
title> <JSX.IntrinsicElements.circle: SVGProps<SVGCircleElement>
circle SVGAttributes<SVGCircleElement>.cx?: string | number | undefined
cx="50" SVGAttributes<SVGCircleElement>.cy?: string | number | undefined
cy="50" SVGAttributes<SVGCircleElement>.r?: string | number | undefined
r="40" /></JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg AriaAttributes["aria-label"]?: string | undefined
Defines a string value that labels the current element.
aria-label="Accessible label" /><JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg AriaAttributes["aria-labelledby"]?: string | undefined
Identifies the element (or elements) that labels the current element.
aria-labelledby="title-id"> <JSX.IntrinsicElements.circle: SVGProps<SVGCircleElement>
circle SVGAttributes<SVGCircleElement>.cx?: string | number | undefined
cx="50" SVGAttributes<SVGCircleElement>.cy?: string | number | undefined
cy="50" SVGAttributes<SVGCircleElement>.r?: string | number | undefined
r="40" /></JSX.IntrinsicElements.svg: SVGProps<SVGSVGElement>
svg>When Not To Use It
Section titled “When Not To Use It”If you’re using a framework that automatically injects appropriate titles for SVG elements, you can disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noSvgWithoutTitle
Made with ❤️🔥 around the world by
the Flint team and contributors.