labb 0.5.0 is out

c-lb.m

<c-lb.m /> Markdown

Meta components for labb django templates: c-lb.m helpers for django-cotton composition and advanced UI patterns.

c-lb.m.* are the meta components that go in your <head>: dependency loading, theme wiring, and asset stacks. They render no visible UI.

Overview

Meta components handle setup and configuration for labb applications: global dependencies, styling, and framework integration.

Reference

c-lb.m.dependencies

Includes the CSS, JavaScript, and styling dependencies for labb components, with optional theme switching.

Usage:

<!-- Basic usage -->
<c-lb.m.dependencies />

<!-- With theme switching endpoint -->
<c-lb.m.dependencies setThemeEndpoint="/api/set-theme/" />

<!-- Force-load the reactivity runtime for hand-rolled data-* markup -->
<c-lb.m.dependencies datastar />

<!-- Without global CSS -->
<c-lb.m.dependencies noGlobalCSS />

Parameters:

  • noGlobalCSS (boolean, default: False) - Skip including the global labb CSS file
  • datastar (boolean, default: False) - Force-load the reactivity runtime. You rarely need this: signals, reactive props, c-lbr. components, and reactive charts each load the runtime on their own where they are used, so static pages ship zero JS. Set it only when you hand-roll data-* reactivity with no labb component to trigger the load. See the Reactivity guide.
  • setThemeEndpoint (string, default: "") - Django endpoint for theme switching via AJAX

What it includes:

  • Global CSS: Automatically includes labb CSS using lb_css_path template tag
  • Reactivity runtime: The small runtime that powers reactive props and c-lbr. components. It is not loaded by default; each reactive surface loads it where it is used, so static pages ship zero JS. Pass datastar to force it on for hand-rolled data-* markup.
  • Theme Controller: JavaScript for theme switching with session persistence when setThemeEndpoint is provided. See the theming documentation for more details.

CSRF Token Requirements:

When using setThemeEndpoint for theme persistence, add {% csrf_token %} in your template's <body> to provide Django's CSRF token for the AJAX request.