Skip to content

Enhance component API with responsive props, color propagation, and typography utilities #650

Open

Description

@ravisuhag

Summary

Enhance Apsara's component-level APIs to improve developer experience, reduce boilerplate, and provide consistent patterns across the library.

1. Responsive Props on Layout Components

Add responsive object syntax to all layout prop values (gap, direction, padding, etc.):

<Flex gap={{ initial: "3", md: "5" }} direction={{ initial: "column", sm: "row" }}>

Support breakpoints: initial, sm, md, lg, xl.

2. Inline Spacing Props

Add shorthand padding/margin props (p, px, py, pt, pr, pb, pl, m, mx, my, mt, mr, mb, ml) to layout components that map to the space scale:

<Box p="4" mx="auto" mt="6">

3. Systematic color Prop

Extend the color prop to all visual components (Badge, Callout, Text, Avatar, Chip, etc.), not just Button. Color should propagate to children through nesting, automatically adjusting internal tokens.

4. highContrast Prop

Add a highContrast boolean to all components that accept a color prop. This shifts colors to steps 9–12 of the scale for better contrast against the page background.

5. Typography Utility Props

Add the following props to Text and Headline:

  • trim — remove leading/trailing whitespace for precise vertical alignment
  • truncate — single-line ellipsis truncation
  • wrap — control text wrapping (wrap, nowrap, balance, pretty)
  • align — text alignment (left, center, right)
  • Expand font weight options to 4 levels: light (300), regular (400), medium (500), bold (700)

6. Section Layout Component

Add a Section component for consistent vertical spacing between major page sections, with predefined size variants (small, medium, large).

Activity

  1. rohanchkrabrty commented on Feb 22, 2026

    @rohanchkrabrty
    Contributor
    1. Responsive Props on Layout Components

    Are the breakpoints fixed on a design system level? Or can they be customised by user during usage?

    If customisation is a requirement we have to move towards runtime style generation, which we should avoid.

    @ravisuhag

  2. added
    globalCross-cutting issue affecting multiple components
    on Mar 9, 2026
  3. rohilsurana commented on Apr 24, 2026

    @rohilsurana
    Member

    Point 5 is already supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    globalCross-cutting issue affecting multiple componentstriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions