Skip to Content
Neshel-UI
Getting started

A responsive layout

Use responsive prop objects to change columns, spacing and direction per breakpoint.

Every responsive prop accepts either a value or an object keyed by breakpoint. Values cascade upwards (mobile first): { base: 1, md: 2, lg: 4 } means one column below md, two from md, four from lg.

src/App.tsx
import { Button, Card, CardContent, CardHeader, CardTitle } from "@neshel-ui/components";
import { Container, Flex, Grid, Stack } from "@neshel-ui/layout";
import { Heading, Paragraph } from "@neshel-ui/typography";

const features = ["Tokens", "Layout", "Typography", "Components"];

export default function App() {
  return (
    <Container size="lg" gutter={{ base: "4", md: "8" }}>
      <Stack space={{ base: "6", md: "10" }} className="py-10">
        <Flex
          direction={{ base: "column", md: "row" }}
          justify="between"
          alignY="center"
          space="4"
        >
          <Heading as="h1" size={{ base: "2xl", md: "4xl" }}>
            Features
          </Heading>
          <Button>Start now</Button>
        </Flex>
        <Grid columns={{ base: 1, sm: 2, lg: 4 }} space={{ base: "3", md: "6" }}>
          {features.map((feature) => (
            <Card key={feature} as="article">
              <CardHeader>
                <CardTitle>{feature}</CardTitle>
              </CardHeader>
              <CardContent>
                <Paragraph size="sm" tone="muted">
                  A short description of {feature.toLowerCase()}.
                </Paragraph>
              </CardContent>
            </Card>
          ))}
        </Grid>
      </Stack>
    </Container>
  );
}

Default breakpoints

KeyMinimum width
base0 (no media query)
sm40rem
md48rem
lg64rem
xl80rem
2xl96rem

They equal Tailwind v4's defaults, so md: utilities and { md: … } props switch together. Each key you write becomes one precompiled class; nothing is computed in the browser.

Preview: grid-columns
Preview theme
Revenue
Customers
Orders
Refunds
Visits
Conversion
grid-columns.tsx
import { Grid } from "@neshel-ui/layout";
import { Tile } from "./_tile";

const cards = ["Revenue", "Customers", "Orders", "Refunds", "Visits", "Conversion"];

/** One column on phones, two from sm, three from lg (responsive columns recipe). */
export default function GridColumns() {
  return (
    <Grid columns={{ base: 1, sm: 2, lg: 3 }} space={{ base: "2", md: "4" }}>
      {cards.map((card) => (
        <Tile key={card}>{card}</Tile>
      ))}
    </Grid>
  );
}

Want names such as phone, tablet and desktop? Define them in neshel.config.ts — see Custom breakpoints. Next: Using the CLI.

Edit on GitHub

On this page