# Comment (`.z-comment`)

> Comment threads with avatar, header, meta, and body sections, nested replies, and a highlighted primary comment.

- **Kind:** css
- **Category:** content

## CSS Variables

| Variable | Default | Scope | Affects | Description |
| --- | --- | --- | --- | --- |
| `--z-comment-avatar-bg` | `var(--z-muted)` | `.z-comment-avatar` | `background-color` | Avatar background base color, mixed with transparency using `--z-comment-avatar-bg-o`. |
| `--z-comment-avatar-bg-o` | `4%` | `.z-comment-avatar` | `background-color` | Avatar background opacity percentage used in the mix. |
| `--z-comment-avatar-radius` | `9999px` | `.z-comment-avatar` | `border-radius` | Corner radius of the avatar. |
| `--z-comment-avatar-size` | `2.5rem` | `.z-comment-avatar` | `height`, `width` | Width and height of the avatar. |
| `--z-comment-header-margin` | `1.25rem` | `.z-comment-header` | `margin-block-end` | Block-end margin of the header. |
| `--z-comment-list-gap` | `0.75rem` | `.z-comment-list > :nth-child(n + 2)` | `margin-block-start` | Block-start margin of the reply list. |
| `--z-comment-meta-font-size` | `0.75rem` | `.z-comment-meta` | `font-size` | Font size of the meta line. |
| `--z-comment-meta-line-height` | `1rem` | `.z-comment-meta` | `line-height` | Line height of the meta line. |
| `--z-comment-meta-margin-top` | `0.25rem` | `.z-comment-meta` | `margin-block-start` | Block-start margin of the meta line. |
| `--z-comment-nested-border-color` | `var(--z-border)` | `.z-comment-list .z-comment ~ ul` | `border-inline-start-color` | Reply thread border base color, mixed with transparency using `--z-comment-nested-border-color-o`. |
| `--z-comment-nested-border-color-o` | `var(--z-border-o)` | `.z-comment-list .z-comment ~ ul` | `border-inline-start-color` | Reply thread border opacity percentage used in the mix. |
| `--z-comment-nested-border-width` | `1px` | `.z-comment-list .z-comment ~ ul` | `border-inline-start-width` | Inline-start border width of the reply thread. |
| `--z-comment-nested-item-gap` | `1.5rem` | `.z-comment-list .z-comment ~ ul > :nth-child(n + 2)` | `margin-block-start` | Block-start margin between nested items. |
| `--z-comment-nested-item-margin` | `0.75rem` | `.z-comment-list .z-comment ~ ul > li` | `margin-inline-start` | Inline-start margin of each nested item. |
| `--z-comment-nested-margin` | `1.5rem` | `.z-comment-list .z-comment ~ ul` | `margin-inline-start` | Inline-start margin of nested replies. |
| `--z-comment-nested-margin-top` | `1.5rem` | `.z-comment-list .z-comment ~ ul` | `margin-block-start` | Block-start margin of nested replies. |
| `--z-comment-padding` | `0.75rem` | `.z-comment` | `padding` | Padding of the comment body area. |
| `--z-comment-primary-bg` | `var(--z-primary)` | `.z-comment-primary` | `background-color` | Primary comment background base color, mixed with transparency using `--z-comment-primary-bg-o`. |
| `--z-comment-primary-bg-o` | `100%` | `.z-comment-primary` | `background-color` | Primary comment background opacity percentage used in the mix. |
| `--z-comment-primary-color` | `var(--z-primary-f)` | `.z-comment-primary` | `color` | Primary comment text base color, mixed with transparency using `--z-comment-primary-color-o`. |
| `--z-comment-primary-color-o` | `100%` | `.z-comment-primary` | `color` | Primary comment text opacity percentage used in the mix. |
| `--z-comment-primary-radius` | `var(--z-global-radius)` | `.z-comment-primary` | `border-radius` | Corner radius of the primary comment. |
| `--z-comment-title-font-size` | `1rem` | `.z-comment-title` | `font-size` | Font size of the title. |
| `--z-comment-title-font-weight` | `500` | `.z-comment-title` | `font-weight` | Font weight of the title. |

## CSS Classes

| Class | Role | Applies to | Description |
| --- | --- | --- | --- |
| `.z-comment` | `root` | `.z-comment` | Root class of one comment. |
| `.z-comment-avatar` | `element` | `.z-comment` | Avatar slot beside the comment. |
| `.z-comment-body` | `element` | `.z-comment` | Comment content body. |
| `.z-comment-header` | `element` | `.z-comment` | Header row holding title and meta. |
| `.z-comment-list` | `element` | `.z-comment` | List of nested replies. |
| `.z-comment-meta` | `element` | `.z-comment` | Secondary meta line (date, actions). |
| `.z-comment-primary` | `element` | `.z-comment` | Highlighted primary comment with tinted background. |
| `.z-comment-title` | `element` | `.z-comment` | Author/title text. |

## Accessibility

> Structure threads as lists; give avatars alt text or mark them decorative, and keep meta actions keyboard-reachable.

## Notes

- Comment is a CSS layer: `.z-comment` articles with header/body sections; nest `.z-comment-list` for replies.

## Guides

- [Styling with cls and stl](https://next.0build.dev/docs/guides/styling.md)
- [Translating Components](https://next.0build.dev/docs/guides/i18n.md)
- [Icon Resolution](https://next.0build.dev/docs/guides/icons.md)
- [The data-source Convention](https://next.0build.dev/docs/guides/data-source.md)
- [Openers & Triggers](https://next.0build.dev/docs/guides/triggers.md)
- [Dialog Behavior](https://next.0build.dev/docs/guides/dialogs.md)
- [Utilities](https://next.0build.dev/docs/guides/utilities.md)
- [Runtime](https://next.0build.dev/docs/guides/runtime.md)

## Related

- [Avatar](https://next.0build.dev/docs/components/avatar.md)
- [List](https://next.0build.dev/docs/components/list.md)
