1.0.0-rc.23 • Published 11 months ago

@bodiless/vital-accordion v1.0.0-rc.23

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

Vital Accordion

The Vital Accordion package provides a simple, extendable and accessible accordion component that can be used to organize non-essential information in a page.

The Vital Accordion package is standalone and does not extend the Bodiless Accordion package, which is deprecated. This means that you only need to install this package to use accordions.

Content Editor Details

Accordions are simple components with an editable title and description. Clicking on the title toggles the accordion, displaying or hiding its description.

Site Builder Details

The Vital Accordion package exports three components:

  • Accordion
  • AccordionTitle
  • AccordionBody

For simple accordions, developers only need to use the Accordion component and its tokens, like in the example below. For further customization, title and body components and tokens are available.

Usage

  import { as, on } from '@bodiless/fclasses';
  import { AccordionClean, vitalAccordion } from '@bodiless/vital-accordion';

  // Using as a React component
  const SimpleAccordion = as(vitalAccordion.Default)(AccordionClean);

  // Using in a token
  const Foo = asFooToken({
    Components: {
      ExampleContent: on(AccordionClean)(vitalAccordion.Default),
    }
  });

Tokens

The Vital Accordion package comes with a few useful tokens.

Base

Exported by: Accordion, AccordionTitle, AccordionBody

This token implements the accordion's basic functionality, like toggling its body when clicking in the title and using Vital Editors for content editing. Use this token as a base if you don't want VitalDS styling.

Default

Exported by: Accordion, AccordionTitle, AccordionBody

This token extends the Base token, adding VitalDS styles. Apply this token to an AccordionClean component for a quick start or use it as a base if you only need to update a few styles.

WithInitiallyExpanded

Exported by: Accordion

Accordions are collapsed on initialization by default, which means that its body is initially hidden when loading a page. By applying this token, the accordion will start expanded, so the user won't need to click on its title to see its content.

  import { as } from '@bodiless/fclasses';
  import { AccordionClean, vitalAccordion } from '@bodiless/vital-accordion';

  const ExpandedAccordion = as(
    vitalAccordion.Default,
    vitalAccordion.WithInitiallyExpanded,
  )(AccordionClean);

WithFAQSchema

Exported by: Accordion, AccordionTitle, AccordionBody

By applying this token, the accordion title and body will be respectively used as a Question and Answer to a Schema.org FAQPage instance. A page can contain any number FAQ accordions.

See the @bodiless/schema-org docs for more information.

  import { as } from '@bodiless/fclasses';
  import { AccordionClean, vitalAccordion } from '@bodiless/vital-accordion';

  const FAQAccordion = as(
    vitalAccordion.Default,
    vitalAccordion.WithFAQSchema,
  )(AccordionClean);
1.0.0-rc.42

11 months ago

1.0.0-rc.41

11 months ago

1.0.0-rc.40

11 months ago

1.0.0-rc.39

11 months ago

1.0.0-rc.38

12 months ago

1.0.0-rc.35

1 year ago

1.0.0-rc.34

1 year ago

1.0.0-rc.37

1 year ago

1.0.0-rc.36

1 year ago

1.0.0-rc.24

1 year ago

1.0.0-rc.28

1 year ago

1.0.0-rc.27

1 year ago

1.0.0-rc.26

1 year ago

1.0.0-rc.25

1 year ago

1.0.0-rc.29

1 year ago

1.0.0-rc.31

1 year ago

1.0.0-rc.30

1 year ago

1.0.0-rc.33

1 year ago

1.0.0-rc.32

1 year ago

1.0.0-rc.23

1 year ago

1.0.0-rc.19

2 years ago

1.0.0-rc.18

2 years ago

1.0.0-rc.20

2 years ago

1.0.0-rc.22

2 years ago

1.0.0-rc.21

2 years ago

1.0.0-rc.17

2 years ago

1.0.0-rc.16

2 years ago

1.0.0-rc.15

2 years ago

1.0.0-rc.14

2 years ago

1.0.0-rc.13

2 years ago

1.0.0-rc.12

2 years ago

1.0.0-rc.10

2 years ago

1.0.0-rc.9

2 years ago

1.0.0-rc.8

2 years ago

1.0.0-rc.7

2 years ago

1.0.0-rc.6

2 years ago

1.0.0-rc.5

2 years ago

1.0.0-rc.4

2 years ago

1.0.0-rc.3

2 years ago