sidebar(defaultopen = True) -> Dict

The sidebar function adds a sidebar to your app, optionally allowing you to customize the logo and title.

Parameters

  • defaultopen (bool, default=True):
    Whether to expand the sidebar on desktop by default.

  • logo (str, optional):
    A URL pointing to the logo image shown at the top of the sidebar.
    Example: "https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg"

  • name (str, optional):
    A string to be shown as the title next to the logo in the sidebar.
    Example: `“Iris Dashboard”

Returns

  • Dict with sidebar component data

Usage Example

Here’s an example of how to add a customizable sidebar to your app:

from preswald import sidebar

sidebar(
    defaultopen=True,
    logo="https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg",
    name="Iris Dashboard"
)

Key Features

  1. Custom Branding: Set a custom logo and title to match your brand or app.
  2. Control: You can use sidebar only if needed which gives you the full control.
  3. Easy to use: No configuration needed—just call the function.

Why Use sidebar?

The sidebar helps organize navigation in your Preswald app and can now also visually reflect your app’s identity through branding.