> ## Documentation Index
> Fetch the complete documentation index at: https://prefab.prefect.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Div & Span

> Unstyled block and inline containers for custom layouts and inline text.

Div and Span are unstyled primitives — the escape hatches for when Row, Column, and Grid don't express what you need. Both support `css_class` for Tailwind and `style` for arbitrary inline CSS.

## Div

A block container with no default styling. Style it through `css_class` or `style`:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import (
>     Div,
>     P,
> )
>
> with Div(css_class="flex items-center gap-3 rounded-lg border p-4"):
>     Div(css_class="bg-emerald-500 rounded-md h-8 w-8")
>     P("Custom layout with Div")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "cssClass": "flex items-center gap-3 rounded-lg border p-4",
>     "type": "Div",
>     "children": [
>       {"cssClass": "bg-emerald-500 rounded-md h-8 w-8", "type": "Div"},
>       {"content": "Custom layout with Div", "type": "P"}
>     ]
>   }
> }
> ```

For CSS that Tailwind can't express — vendor prefixes, `clamp()`, `mask-image`, etc. — use the `style` prop:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import (
>     Div,
>     P,
> )
>
> with Div(style={
>     "background": "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
>     "border-radius": "12px",
>     "padding": "24px",
> }):
>     P("Styled with inline CSS", css_class="text-white font-medium")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "Div",
>     "style": {
>       "background": "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
>       "border-radius": "12px",
>       "padding": "24px"
>     },
>     "children": [
>       {
>         "cssClass": "text-white font-medium",
>         "content": "Styled with inline CSS",
>         "type": "P"
>       }
>     ]
>   }
> }
> ```

## Span

An inline text element with no default styling. Useful for inline annotations or colored text:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import (
>     P,
>     Row,
>     Span,
> )
>
> with Row(gap=2, align="baseline"):
>     P("Status:")
>     Span("Online", css_class="text-sm text-success font-medium")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "cssClass": "gap-2 items-baseline",
>     "type": "Row",
>     "children": [
>       {"content": "Status:", "type": "P"},
>       {
>         "cssClass": "text-sm text-success font-medium",
>         "content": "Online",
>         "code": false,
>         "type": "Span"
>       }
>     ]
>   }
> }
> ```

## API Reference

> [card] Div Parameters
>
> **css\_class** `str | None` (default: None)
>
> Tailwind CSS classes. Div has no built-in styling.
>
> **style** `dict[str, str] | None` (default: None)
>
> Inline CSS styles for properties that Tailwind can't express.

> [card] Span Parameters
>
> **content** `str` *required*
>
> Text content. Can be passed as a positional argument.
>
> **css\_class** `str | None` (default: None)
>
> Tailwind CSS classes. Span has no built-in styling.
>
> **style** `dict[str, str] | None` (default: None)
>
> Inline CSS styles for properties that Tailwind can't express.

## Protocol Reference

```json Div theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "Div",
  "id?": "string",
  "onMount?": "any",
  "children?": "[Component]",
  "let?": "object",
  "style?": "object",
  "cssClass?": "string"
}
```

```json Span theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "Span",
  "id?": "string",
  "onMount?": "any",
  "content": "string (required)",
  "bold?": "boolean",
  "italic?": "boolean",
  "underline?": "boolean",
  "strikethrough?": "boolean",
  "uppercase?": "boolean",
  "lowercase?": "boolean",
  "code?": false,
  "align?": "null",
  "style?": "object",
  "cssClass?": "string"
}
```

For the complete protocol schema, see [Div](https://prefab.prefect.io/docs/protocol/div.md), [Span](https://prefab.prefect.io/docs/protocol/span.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.