Orbit Design System

repository·master·Indexed 23 days ago

https://github.com/kiwicom/orbit

A design system and component library for building travel products with consistent design and user experience. It includes @kiwicom/orbit-components, a set of React components such as Alert, Accordion, and AirportIllustration, and @kiwicom/babel-plugin-orbit-components to optimize bundle size by transforming destructured imports into granular, direct imports.

Tokens
236.6K
Snippets
342
Records
1.3K
Agent score
73%

What's inside Orbit

  1. Understand the core principles of Orbit

    master

    Orbit is more than a component library; it is a design system built on years of experience in travel products, incorporating accessibility, internationalization, advanced theming, and travel-specific components. The development of Orbit is guided by several core values intended to balance the needs of designers and developers:

    • Finding the middle ground: Orbit aims to balance consistency, designer/developer experience, maintainability, and composability.
    • Transparency: Design decisions are documented to provide historical context and avoid repetitive discussions.
    • Listening and reacting: The system is built on research and active user feedback to ensure it meets real-world needs.
    • Intuitive design: Focuses on clarity and using familiar patterns and vocabulary to make components self-explanatory.
    • Controlled flexibility: Provides delightful components that work out-of-the-box with "appropriate defaults," while offering enough flexibility for consumers to extend them for specific use cases.
    • Contextual documentation: Documentation is designed to be a partner that solves problems at the right moment, rather than just describing obvious visual styles.
  2. What is progressive disclosure and when to use it

    master

    Progressive disclosure is a design principle used to manage information overload by showing users only what they need at a given time to make a decision, while keeping secondary options just a tap away.

    Use this principle to:

    • Simplify designs: Highlight the primary goal of a specific screen or step.
    • Reduce cognitive load: Prevent users from being overwhelmed by too many choices at once.
    • Manage advanced options: Hide complex or infrequent settings behind interactions so they don't clutter the primary user flow.

    When deciding what to disclose progressively, ask:

    1. What is the user's primary goal at this moment?
    2. Is there information needed only some of the time?
    3. If all info were visible, what would users choose to hide?
    4. Is the information an additional explanation of something already present?
  3. Content constraints for NotificationBadge

    master

    Because NotificationBadge is small and circular, it has strict content limitations:

    • Content types: Use either an icon OR a number. If an icon is used, the number is not displayed.
    • Length: If using a number, limit it to no more than 2 digits.
    • Accessibility: If you use only an icon, you must include the same information non-visually (e.g., via screen reader text) to ensure the message is accessible to users who cannot see the icon.
  4. Breadcrumbs responsive behavior and content structure

    master

    The Breadcrumbs component adapts its content based on the screen size to maintain usability:

    Desktop

    On larger screens, the component displays the full path:

    • Root item: Usually the name of your product.
    • Full path: Shows the hierarchy leading to the current page.
    • Current page: The final item in the list, showing the name of the page the user is currently on.

    Mobile

    On smaller screens, to avoid clutter and line-breaking issues, the component simplifies to a single option:

    • Back button: Shows only the immediate parent, allowing users to navigate one step back in the hierarchy.
  5. How TooltipPrimitive positioning and behavior works

    master

    Positioning Logic

    Whenever onMouseEnter, onFocus, or onClick events fire, the component calculates possible positions and applies the first valid one. You can influence this by providing a preferred placement. If the preferred position is unavailable, it falls back to a default order defined in the component's internal enum.

    Mobile Behavior

    On mobile devices, users must click on the children to open the TooltipPrimitive.

    DOM Rendering

    To ensure the Tooltip renders in a specific location, add a div with id="tooltips" to your application. If this element is not found, the Tooltip will be rendered at the end of the DOM.

  6. Use dashes and hyphens correctly

    master

    Distinguish between these three types of dashes:

    • Hyphen (-): Use for compound words without spaces (e.g., 1-hour flight, co-traveler).
    • En-dash (–): Use for ranges of numbers or dates without spaces (e.g., 12:30–14:35, 1–2 days). When describing locations, replace with an arrow with spaces (e.g., Prague → Barcelona).
    • Em-dash (—): Use instead of commas or colons, with spaces before and after (e.g., We checked you in — now you can download your boarding passes.).
  7. How Accordion handles automatic accessibility

    master

    When expandOnTileClick is set to true on an AccordionSection, the component automatically manages several ARIA attributes and keyboard behaviors to ensure the header acts as a functional interactive element:

    • Role: The header is assigned role="button".
    • State: aria-expanded is toggled between true and false based on the section's state.
    • Relationship: aria-controls is used to associate the header with its corresponding content section.
    • Focus: tabIndex is set to 0, allowing the header to be included in the natural tab order.

    Keyboard Navigation Support:

    • Enter/Space: Toggles the expansion state when the header is focused.
    • Tab / Shift + Tab: Navigates focus between headers and interactive elements within expanded sections.
    <Accordion id="faq-accordion">
      <AccordionSection id="section-1" header="What is Orbit?" expandOnTileClick>
        Orbit is Kiwi.com's design system for creating consistent user experiences across products.
      </AccordionSection>
      <AccordionSection id="section-2" header="How do I use Accordion?" expandOnTileClick>
        Import the Accordion and AccordionSection components and nest the sections within the accordion.
      </AccordionSection>
    </Accordion>
  8. Table visual behavior and styling

    master

    Hover behavior

    To help users match rows to columns in multi-column tables, Orbit tables feature a hover state. When a row is hovered, it receives a <InlineToken name="paletteCloudNormal" /> background, making the data easier to scan.

    Colors and styling

    The Table component supports configuration for:

    • Row backgrounds: Options for whether or not the table is striped.
    • Text color: Options to adjust the color of the text within the table.