RDraw-layout

Layout Component Documentation

Overview

The layout component is a flexible, responsive Lightning Web Component that provides a grid-based layout system for Salesforce applications. It supports multiple content areas including context panels, sidebars, main content, and action information panes with configurable sizing and responsive behavior.

Features

  • Responsive Grid System: Uses Salesforce Lightning Design System (SLDS) grid for consistent responsive behavior

  • Multiple Content Areas: Supports context panels, sidebars, main content, and action information panes

  • Dynamic Sizing: Automatically calculates content area sizes based on visible panels

  • Context Details: Expandable context details with navigation controls

  • Flexible Configuration: Customizable panel sizes and display options

  • Smooth Animations: CSS transitions and animations for panel show/hide operations

Component Structure

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Advanced Body                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Context    β”‚      Main Content       β”‚     Sidebar      β”‚
β”‚   Panel      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚     Panel        β”‚
β”‚              β”‚  β”‚ Action Info Pane    β”‚ β”‚                  β”‚
β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚                  β”‚
β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚                  β”‚
β”‚              β”‚  β”‚   Render Wrapper    β”‚ β”‚                  β”‚
β”‚              β”‚  β”‚   (Main Content)    β”‚ β”‚                  β”‚
β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

API Reference

Public Properties

Property
Type
Default
Description

sidebarContent

Boolean

false

Controls sidebar content display

contextDetailHeaderText

String

''

Header text for context details panel

displaySidebar

Boolean

false

Shows/hides the sidebar panel

displayActionInformationPane

Boolean

false

Shows/hides the action information pane

size

String

'Large'

Sets the overall size of the layout

displayContext

Boolean

false

Shows/hides the context panel

displayContextDetails

Boolean

false

Shows/hides the context details view

mainContentSize

Number

12

Grid size for main content (1-12)

contextSize

Number

3

Grid size for context panel (1-12)

sidebarSize

Number

4

Grid size for sidebar panel (1-12)

Size Options

The size property accepts the following values:

  • 'Small' - 25vh height

  • 'SmallPlus' - 35vh height

  • 'Medium' - 50vh height

  • 'MediumPlus' - 60vh height

  • 'Large' - 70vh height (default)

  • 'LargePlus' - 85vh height

  • 'Jumbo' - 100vh height

  • 'Stretch' - 100% height

Slots

Slot Name
Description

contextContent

Content for the context panel

contextDetailContent

Content for the context details view

actionInformationPane

Content for the action information area

mainContent

Primary content area

sidebarContent

Content for the sidebar panel

Events

Event Name
Description
Event Detail

contextdetailsclose

Fired when context details panel is closed

None

Public Methods

Method
Description

resetContentSize()

Recalculates and updates content area sizes based on visible panels

handleCloseContextDetails()

Closes the context details panel and fires the close event

Usage Examples

Basic Layout with Main Content

Layout with Sidebar

Full Layout with All Panels

Dynamic Context Details

JavaScript Controller Examples

Basic Controller Setup

Advanced Controller with Dynamic Sizing

Responsive Behavior

The layout component automatically adjusts content areas based on:

  1. Available Panels: Main content size decreases as panels are shown

  2. Panel Sizes: Custom sizes for context and sidebar panels

  3. Screen Size: Uses SLDS responsive grid classes

  4. Content Flow: Flexbox layout ensures proper content distribution

Size Calculations

  • Base Size: 12 grid columns

  • With Context: Main content = 12 - contextSize

  • With Sidebar: Main content = 12 - sidebarSize

  • With Both: Main content = 12 - contextSize - sidebarSize

Best Practices

  1. Size Configuration: Choose appropriate sizes based on content needs

  2. Responsive Design: Test with different screen sizes and panel combinations

  3. Content Organization: Use slots appropriately for different content types

  4. Performance: Avoid frequent size changes that trigger recalculations

  5. Accessibility: Ensure proper focus management when panels open/close

Common Use Cases

  1. Dashboard Layout: Main dashboard with sidebar navigation and context filters

  2. Detail Pages: Record details with related information panels

  3. Workflow Applications: Multi-step processes with contextual guidance

  4. Data Visualization: Charts with filtering options and detail panels

  5. Form Layouts: Complex forms with help text and validation information

Last updated