0.1.6 • Published 3 years ago

@vtex/disclosure v0.1.6

Weekly downloads
20
License
MIT
Repository
-
Last release
3 years ago

Disclosure

yarn add @vtex/disclosure

Usage

Rendering one disclosure:

<DisclosureLayout>
  <DisclosureTrigger>Trigger</DisclosureTrigger>
  <DisclosureContent>Content</DisclosureContent>
</DisclosureLayout>

Rendering multiple disclosures:

<DisclosureLayoutGroup>
  <DisclosureLayout>
    <DisclosureTrigger>Trigger 1</DisclosureTrigger>
    <DisclosureContent>Content 1</DisclosureContent>
  </DisclosureLayout>
  <DisclosureLayout>
    <DisclosureTrigger>Trigger 2</DisclosureTrigger>
    <DisclosureContent>Content 2</DisclosureContent>
  </DisclosureLayout>
  <DisclosureLayout>
    <DisclosureTrigger>Trigger 3</DisclosureTrigger>
    <DisclosureContent>Content 3</DisclosureContent>
  </DisclosureLayout>

  <DisclosureTriggerGroup>Trigger Group</DisclosureTriggerGroup>
</DisclosureLayoutGroup>

Run the project's Storybook for a full list of examples with yarn storybook.

API

DisclosureTrigger

Prop NameTypeDescriptionDefault value
showReactNodeThis prop will be rendered when prompt to show the contentundefined
hideReactNodeThis prop will be rendered when prompt to hide the contentundefined
asanyUse this to render a different HTML tagbutton
htmlPropsHTMLPropsUse this to pass any props to the HTML elementundefined
childrenReactNodeThis prop will be rendered if no show or hide is setundefined

DisclosureContent

Prop NameTypeDescriptionDefault value
asanyUse this to render a different HTML tagbutton
htmlPropsHTMLPropsUse this to pass any props to the wrapping HTML elementundefined
childrenReactNodeThis prop is the content of the disclosureundefined

DisclosureLayout

Prop NameTypeDescriptionDefault value
initialVisibilityenumvisible to have it's content initially open, or hidden to be hidden.hidden
animatedboolean or numberTo perform animations, you must set this to true. It'll enable additional data-* attributes on it's content which you can use as selectors in CSS. It will also ensure that the element will only get hidden when the transition has ended.false

DisclosureLayoutGroup

Prop NameTypeDescriptionDefault value
maxVisibleenumPossible values one it will render only one DisclosureLayout content per group, or many multiple DisclosureLayout's content can be rendered.one

DisclosureTriggerGroup

Prop NameTypeDescriptionDefault value
showReactNodeThis prop will be rendered when prompt to show the contentundefined
hideReactNodeThis prop will be rendered when prompt to hide the contentundefined
asanyUse this to render a different HTML tagbutton
htmlPropsHTMLPropsUse this to pass any props to the HTML elementundefined
childrenReactNodeThis prop will be rendered if no show or hide is setundefined

DisclosureStateIndicator

Prop NameTypeDescriptionDefault value
showReactNodeThis prop will be rendered when prompt to show the contentundefined
hideReactNodeThis prop will be rendered when prompt to hide the contentundefined
0.1.6

3 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago