Lynx

Tailwind CSS 3

Guides how to use Tailwind CSS v3 and Crispy design tokens in Lynx.

Overview

This guide is for existing Tailwind CSS v3 projects. If you're setting up new, choose Vanilla Extract or Tailwind CSS v4 in Installation.

With @seed-design/tailwind3-plugin, you can use Crispy tokens as utility classes for native <view> and <text>. For projects using Tailwind CSS v4, see v4 configuration. Theme configuration is covered in Theming.

Setup

npm install @seed-design/lynx-css tailwindcss@3 @seed-design/tailwind3-plugin

tailwind.config.ts

import type { Config } from "tailwindcss";
import seedDesignPlugin from "@seed-design/tailwind3-plugin";

export default {
  content: ["./src/**/*.{jsx,tsx}"],
  corePlugins: { preflight: false },
  plugins: [seedDesignPlugin],
} satisfies Config;

postcss.config.js

export default {
  plugins: {
    tailwindcss: {},
  },
};

CSS

@import "@seed-design/lynx-css/base.css";

@tailwind components;
@tailwind utilities;

Color

Crispy color tokens are used with Tailwind's bg-, text-, border- prefixes.

// Background color
<view className="bg-bg-layer-default" />
<view className="bg-bg-neutral-weak" />
<view className="bg-bg-brand-solid" />

// Text color
<text className="text-fg-neutral">Default text</text>
<text className="text-fg-brand">Brand text</text>
<text className="text-fg-critical">Error text</text>

// Border color
<view className="border border-stroke-neutral-muted" />

Typography

Crispy typography tokens are provided as component classes.

<text className="t1-regular">Smallest text</text>
<text className="t5-regular">Default body</text>
<text className="t5-bold">Bold body</text>
<text className="t7-bold">Large title</text>
<text className="t10-bold">Largest title</text>

Layout

Use Tailwind's Flexbox utilities with native <view> elements.

// Flex row (HStack)
<view className="flex flex-row gap-x2 items-center">
  <view className="bg-bg-brand-weak px-x3 py-x2 rounded-r2">
    <text>A</text>
  </view>
  <view className="bg-bg-brand-weak px-x3 py-x2 rounded-r2">
    <text>B</text>
  </view>
</view>

// Flex column (VStack)
<view className="flex flex-col gap-x2">
  <text className="t5-regular text-fg-neutral">Item 1</text>
  <text className="t5-regular text-fg-neutral">Item 2</text>
</view>

Lynx Platform Notes

  • overflow: scroll is not supported. If you need scrolling, use the <scroll-view> element.
  • The default value of position is relative (different from web's static).
  • <list> + <list-item> are used for virtualized lists. item-key is required.
  • CSS initial, inherit, unset keywords are not supported.
  • The inset shorthand is not used as of Lynx 3.7. Write top, right, bottom, left longhand directly.

Table of contents