Norsk Tipping Design System

Accordion.Item

Install

yarn add @ntds/accordion

Import

import { Accordion } from '@ntds/accordion';

Usage

<Accordion tw={{ sizing: 'max-w-sm' }}>
    <Accordion.Item
        headingLevel={2}
        title='Title'
        details={() => (
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
        )}
    />
    <Accordion.Item
        headingLevel={2}
        title='What does Lorem ipsum?'
        details={() => (
            <>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
                <p>Tristique nostra eget nisl tortor ex placerat habitasse et.</p>
                <p>Suspendisse vulputate pretium laoreet eu posuere ligula cursus ornare suscipit ipsum risus himenaeos elit suspendisse.</p>
            </>
        )}
    />
</Accordion>

Props

PropTypeDefaultDescription
headingLevelHeadingLevelThe heading level to use in-context. The level used will not change the appearance or style. 1 = <h1> 2 = <h2> ... and so on
noHeading?booleanRender a <span> instead of <H> tag
titleReactNodeThe summary text that is always shown. When clicked, will expand the detail section.
startOpen?booleanfalseWhether or not to render the AccordionItem expanded by default The user can still close it.
open?booleanWhether or not to render the AccordionItem expanded or not This property let you control the openness of the accordion item programmatically.
onChange?(open: boolean) => voidFires when the internal Accordion.Item state changes to enable feedback to external state.
tw?TwGroupKeysTailwind overrides for the container-element
twDetails?TwGroupKeysTailwind overrides for the expanded details container
twIconWrapper?stringTailwind overrides for icon (mx-3)
twChevronWrapper?stringTailwind overrides for chevron icon the mx-3
details() => ReactNodeUsually simple text, but can be anything.
large?booleanlarger text
icon?ReactNodechoose icon
twHeadingColor?stringcolor for heading
twContainerColor?stringcolor for container
twFontWeightHeading?"font-normal" | "font-medium" | "font-bold"font-size for heading font-normal, font-medium, font-bold
twContainerPadding?stringpadding for container
twContainerTextColor?stringtextcolor for container
twFontWeightContainer?"font-normal" | "font-medium" | "font-bold"font-size for heading font-normal, font-medium, font-bold

On this page