FAQ

Use the FAQ component to display content in a Q&A format.

import {FAQ, FAQGroup} from '@primer/react-brand'

Examples

Default

Grouped FAQs

Use FAQGroup to display multiple FAQ components together.

Rendering with dynamic data

Color customization

FAQ surfaces component-specific css variables that can be used to adjust the color where needed.

Component props

FAQ Required

NameTypeDefaultDescription
classNamestringSets a custom class
idstringSets a custom id
refReact.RefObjectForward a Ref to the underlying DOM node
childrenFAQ.Heading
FAQ.Subheading
FAQ.Item
Root element for the FAQ component.

FAQ.Heading Required

NameTypeDefaultDescription
align'start'
'center'
'center'Heading text alignment
childrenstringHeading text
classNamestringHeading custom class
idstringSets a custom id
refReact.RefObjectForward a Ref to the underlying DOM node
size'medium'
'large'
'medium'Heading text size
as'h1'
'h2'
'h3'
'h4'
'h5'
'h6'
Applies the underlying HTML element

FAQ.Subheading

NameTypeDefaultDescription
childrenstringSub-heading text
classNamestringSub-heading custom class
idstringSets a custom id
as'h2'
'h3'
'h4'
'h5'
'h6'
'h3'Applies the underlying HTML element
refReact.RefObjectForward a Ref to the underlying DOM node

FAQ.Item

NameTypeDefaultDescription
openbooleanfalseSets answer visibility
classNamestringSets a custom class
childrenFAQ.Question
FAQ.Answer
FAQ question and answer pair
idstringSets a custom id
refReact.RefObjectForward a Ref to the underlying DOM node

FAQ.Question

NameTypeDefaultDescription
classNamestringSets a custom class on the root element
childrenstringQuestion text
idstringSets a custom id
as'h2'
'h3'
'h4'
'h5'
'h6'
'h4'Applies the underlying HTML element
refReact.RefObjectForward a Ref to the underlying DOM node

FAQ.Answer

NameTypeDefaultDescription
classNamestringSets a custom class on the root element
childrenReactElement<p> or <Text> components are recommended
idstringSets a custom id
refReact.RefObjectForward a Ref to the underlying DOM node

FAQGroup

NameTypeDefaultDescription
classNamestringSets a custom class
idstringSets a custom id
refReact.RefObjectForward a Ref to the underlying DOM node
childrenFAQ
FAQGroup.Heading
Root element for the FAQGroup component.

FAQGroup.Heading

NameTypeDefaultDescription
as'h1'
'h2'
'h3'
'h4'
'h5'
'h6'
Applies the underlying HTML element

Forwards all the props from the Heading component, including size, and weight.