Inference Logoinference.sh

Caption

Supplemental text for descriptions, hints, or metadata.

Preview

code
1Default caption2Secondary color, smaller size

Usage

go
1node := models.WidgetNode{2    Type:  models.WidgetNodeTypeCaption,3    Value: "Last updated 2 hours ago",4}

Props

NameTypeDescriptionDefault
type"caption"Node typerequired
valuestringText content to displayrequired
sizestringSize token: sm, md, lg"md"
weightstringFont weight: normal, medium, semibold, bold"normal"
colorstring | ThemeColorText color"secondary"
textAlignstringHorizontal alignment: start, center, end"start"
truncatebooleanTruncate overflow with ellipsisfalse
maxLinesnumberLimit to maximum lines-

Color Tokens

  • prose - Default text color
  • primary - Primary brand color
  • emphasis - Emphasized text
  • secondary - Muted/secondary text (default for Caption)
  • tertiary - Even more muted
  • success - Success green
  • warning - Warning yellow
  • danger - Error red

Examples

Basic Caption

go
1{Type: models.WidgetNodeTypeCaption, Value: "Optional field"}

Title with Caption

go
1{2    Type: models.WidgetNodeTypeCol,3    Gap:  1,4    Children: []models.WidgetNode{5        {Type: models.WidgetNodeTypeTitle, Value: "Profile"},6        {Type: models.WidgetNodeTypeCaption, Value: "Manage your personal information"},7    },8}

Success Caption

go
1{Type: models.WidgetNodeTypeCaption, Value: "Changes saved successfully", Color: "success"}

Form Field Hint

go
1{2    Type: models.WidgetNodeTypeCol,3    Gap:  1,4    Children: []models.WidgetNode{5        {Type: models.WidgetNodeTypeInput, Name: "password", Placeholder: "Password"},6        {Type: models.WidgetNodeTypeCaption, Value: "Must be at least 8 characters"},7    },8}

TypeScript

typescript
1const node: WidgetNode = {2  type: "caption",3  value: "Helpful hint",4  size: "sm",5  color: "secondary",6}

Best Practices

  1. Use for context - Explain or clarify the main content
  2. Keep short - Captions should be 1-2 sentences max
  3. Secondary by default - Use muted color for non-essential info
  4. Pair with Title - Great for section descriptions

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.