Skip to content

Panel ​

The Panel component provides a structured and accessible container to group semantically related content.
It can be rendered as either a <section> or a <div>, and includes dedicated slots for the header, main content, and footer.

✨ Features ​

  • Rendered as <section> or <div>
  • Provides head, default, and footer slots
  • Compatible with light and dark themes
  • Supports RTL (Right-to-Left) languages
  • Compliant with WCAG 2.1 AA accessibility standards
  • Supports ARIA roles and accessible titles

🚀 Usage examples ​

Basic example ​

vue
<template>
  <SuPanel>
    <template #head>
      <SuHeading level="2">Main Information</SuHeading>
    </template>

    <p>This is the main content of the panel.</p>

    <template #footer>
      <button>Learn more</button>
    </template>
  </SuPanel>
</template>

API ​

Props ​

PropTypeDefaultDescription
asstring'section'Defines the HTML tag used for the main container (section or div).
outlinedbooleanfalseAdds a border around the panel.
elevatedbooleanfalseAdds a shadow for a raised visual effect.
classstring-Additional CSS classes to apply.

Slots ​

SlotDescription
headHeader content (usually a Heading or title)
defaultMain content of the panel
footerFooter area (buttons, links, summary, etc.)

Example with style options ​

vue
<SuPanel outlined elevated>
  <template #head>
    <SuHeading level="3">Order Summary</SuHeading>
  </template>

  <p>Total amount: €85.90</p>

  <template #footer>
    <button>Confirm</button>
  </template>
</SuPanel>

Best practices ​

  • Use the <section> tag for semantically distinct blocks.
  • Use the as="div" prop for purely visual or nested panels.
  • The head slot should always include an accessible heading (Heading or equivalent).

Accessibility attributes ​

AttributeRole / PurposeExample
roleDefines the purpose of the panel (region, group)role="region"
aria-labelledbyLinks the panel to a visible title for screen readersaria-labelledby="panelTitle"
aria-describedbyProvides an optional description for the panel’s contentaria-describedby="panelDesc"

HTML validation attributes ​

AttributeDescription
idUnique identifier for the section
langLanguage of the content if different from the page
dirText direction (ltr, rtl, or auto)

Accessibility ​

The Panel component complies with WCAG 2.1 Level AA and follows W3C ARIA best practices.

Accessibility features

  • Semantic roles (section, region) depending on context.
  • Optional linkage to a title via aria-labelledby.
  • Color contrast and spacing meet accessibility requirements.
  • Touch targets respect the minimum 44×44px standard.

Advanced usage examples ​

Nested panels

vue
<SuPanel outlined>
  <template #head>
    <SuHeading level="2">Main Section</SuHeading>
  </template>

  <SuPanel as="div" outlined>
    <template #head>
      <SuHeading level="3">Subsection</SuHeading>
    </template>
    <p>Secondary content.</p>
  </SuPanel>
</SuPanel>

Dynamic panel

vue
<SuPanel v-if="showPanel" elevated>
  <template #head>
    <SuHeading level="3">Notifications</SuHeading>
  </template>
  <ul>
    <li v-for="notif in notifications" :key="notif.id">
      {{ notif.message }}
    </li>
  </ul>
</SuPanel>

Publié sous licence MIT.