Skip to contentSkip to navigationSkip to topbar
Paste assistant Assistant
Figma
Star

Side Panel

Version 0.0.0GithubStorybookPeer review pending

Side Panel is a container that pushes the main page content when open.

Installation

Installation page anchor
yarn add @twilio-paste/side-panel - or - yarn add @twilio-paste/core
import {
  SidePanelContainer,
  SidePanel,
  SidePanelHeader,
  SidePanelHeaderActions,
  SidePanelBody,
  SidePanelPushContentWrapper,
  SidePanelButton,
} from '@twilio-paste/core/side-panel';

const SideModalExample: React.FC = () => {
  const [isOpen, setIsOpen] = React.useState(true);
  return (
    <SidePanelContainer isOpen={isOpen} setIsOpen={setIsOpen}>
      <SidePanel>
        <SidePanelHeader>
          Heading goes here.
          <SidePanelHeaderActions>
            Actions go here.
          </SidePanelHeaderActions>
        </SidePanelHeader>
        <SidePanelBody>
          Side Panel content goes here.
        </SidePanelBody>
      </SidePanel>
      <SidePanelPushContentWrapper>
          <SidePanelButton variant="secondary">Toggle Side Panel</SidePanelButton>
      </SidePanelPushContentWrapper>
    </SidePanelContainer>
  );
};

SidePanelButton

SidePanelButton page anchor

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
'SIDE_PANEL_BUTTON'

id

Type
string

toggle

Type
() => void

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
'SIDE_PANEL_BADGE'

id

Type
string

toggle

Type
() => void

label RequiredRequired

Accessible label for the Side Panel

Type
string

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
SIDE_PANEL

SidePanelPushContentWrapper

SidePanelPushContentWrapper page anchor

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
SIDE_PANEL_PUSH_CONTENT_WRAPPER

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
SIDE_PANEL_HEADER

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
SIDE_PANEL_HEADER_ACTIONS

isOpen RequiredRequired

State for the Side Panel. Determines whether the Side Panel is open or closed.

Type
boolean

setIsOpen RequiredRequired

Sets the state of the Side Panel between open and closed.

Type
Dispatch<SetStateAction<boolean>>

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
SIDE_PANEL_CONTAINER

i18nCloseSidePanelTitle

Accessible title for the close Side Panel button for non-english languages

Type
string
Default
close the side panel

i18nOpenSidePanelTitle

Accessible title for the open Side Panel button for non-english languages

Type
string
Default
open the side panel

sidePanelId

Id for the Side Panel. Gets passed to the aria-controls attribute of the Side Panel Button for accessibility. A unique ID will be created if nothing is passed.

Type
string

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
SIDE_PANEL_BODY