MYDS Logo

    MYDS

    Beta

    Accordion

    Organize and display content in a compact, collapsible format, commonly used for FAQ sections.

    MYDS is a design system for building official Malaysian government products over the web. MYDS provides beautiful pre-built components which streamline development and promote consistency across government products.

    Usage

    import {
      AccordionTrigger,
      AccordionContent,
      Accordion,
      AccordionItem,
    } from "@govtechmy/myds-react/accordion";
    export default () => (
      <Accordion>
        <AccordionItem>
          <AccordionTrigger></AccordionTrigger>
          <AccordionContent></AccordionContent>
        </AccordionItem>
      </Accordion>
    );

    Examples

    Type

    Use the type prop to change how the content should be displayed!

    • single: only allow one content to be shown at a time

    • multiple: allow multiple contents to be shown at the same time.

    MYDS is a design system for building official Malaysian government products over the web. MYDS provides beautiful pre-built components which streamline development and promote consistency across government products.

    Collapsible

    Use the collapsible prop to determine whether all the accordion is collapsible! By default, it is set to true. Please note this only works when type="single".

    MYDS is a design system for building official Malaysian government products over the web. MYDS provides beautiful pre-built components which streamline development and promote consistency across government products.

    Disabled

    The disabled prop exists in both Accordion and AccordionItem components.

    Setting disabled to true in Accordion will disable all the AccordionItem components, while in AccordionItem will disable the respective AccordionItem.

    MYDS is a design system for building official Malaysian government products over the web. MYDS provides beautiful pre-built components which streamline development and promote consistency across government products.

    Props

    Accordion

    PropTypeDefault
    type
    enum
    small
    value
    string|string[]
    -
    defaultValue
    string|string[]
    -
    onValueChange
    string|string[]
    -
    collapsible
    string|string[]
    -
    disabled
    string|string[]
    -

    AccordionItem

    PropTypeDefault
    asChild
    boolean
    false
    value
    string|string[]
    -
    disabled
    string|string[]
    -

    AccordionTrigger

    PropTypeDefault
    asChild
    boolean
    false

    AccordionContent

    PropTypeDefault
    asChild
    boolean
    false

    For more in-depth customization, you can refer to API references in this documentation

    On this page