Entity Display

A compact display for any entity — file, user, task — with an icon, title, and optional description. Supports middle truncation.

Overview

A general-purpose compound component for displaying an entity with an icon, title, and optional description line. Supports three sizes, two visual variants, hover styling, and measurement-based middle truncation that adapts to inline-flex, button, and other auto-sized containers.

Usage

import { EntityDisplay } from "@tilt-legal/cubitt-components/primitives";
<EntityDisplay size="sm">
  <EntityDisplay.Icon>
    <MimeTypeIcon fileName="report.pdf" />
  </EntityDisplay.Icon>
  <EntityDisplay.Label>
    <EntityDisplay.Title middleTruncate>report.pdf</EntityDisplay.Title>
    <EntityDisplay.Description>PDF Document</EntityDisplay.Description>
  </EntityDisplay.Label>
</EntityDisplay>

Examples

Default Variant

The default variant includes a border and background. Available in sm, md, and lg sizes.

Ghost Variant

The ghost variant removes the background and padding. At md and lg sizes, the icon gets a circular background. When hoverable is enabled, the title underlines on hover.

Middle Truncation

The middleTruncate prop on EntityDisplay.Title enables measurement-based middle truncation that works correctly inside inline-flex containers, buttons, and other auto-sized parents — preserving the end of the text (e.g. file extensions).


API Reference

EntityDisplay (Root)

The root container. Provides context for size, variant, and truncation measurement to all sub-components.

PropTypeDefaultDescription
variant"default" | "ghost""default"Visual style. default has filled background with padding, ghost is transparent.
size"sm" | "md" | "lg""md"Size variant controlling gap, icon size, and text.
hoverablebooleanfalseEnable hover styling. Default variant highlights background, ghost underlines text.
classNamestringAdditional classes.

EntityDisplay.Icon

Styled container for the entity icon. Sizes the SVG child based on the root's size and variant. Ghost md/lg renders a circular background with border.

PropTypeDefaultDescription
classNamestringAdditional CSS classes

EntityDisplay.Label

Flex column container for title and description. Attaches the measurement ref used by middle truncation.

PropTypeDefaultDescription
classNamestringAdditional CSS classes

EntityDisplay.Title

The primary text line. Supports optional measurement-based middle truncation.

PropTypeDefaultDescription
middleTruncatebooleanfalseEnable measurement-based middle truncation. Children must be a plain string when enabled.
classNamestringAdditional CSS classes

EntityDisplay.Description

A secondary text line rendered below the title with muted text color. Always CSS-truncated.

PropTypeDefaultDescription
classNamestringAdditional CSS classes

On this page