Yamada UIにスターをあげる

スター
Yamada UIYamada UIv1.5.1

SimpleGrid

SimpleGridは、Gridをより使いやすくシンプルにしたコンポーネントです。

ソース@yamada-ui/layouts

インポート

import { SimpleGrid, GridItem } from "@yamada-ui/react"
Copied!

使い方

編集可能な例

<SimpleGrid w="full" columns={{ base: 2, md: 1 }} gap="md">
  <GridItem w="full" h="4xs" rounded="md" bg="primary" />
  <GridItem w="full" h="4xs" rounded="md" bg="secondary" />
  <GridItem w="full" h="4xs" rounded="md" bg="warning" />
  <GridItem w="full" h="4xs" rounded="md" bg="danger" />
</SimpleGrid>
Copied!

子要素の最小幅を設定する

子要素の最小幅を設定する場合は、minChildWidthに横幅を設定します。

例えば、120pxを指定した場合、CSSプロパティのgridTemplateColumnsは、repeat(auto-fit, minmax(120px, 1fr))になります。

編集可能な例

<SimpleGrid w="full" minChildWidth={{ base: "3xs", lg: 100 }} gap="md">
  <GridItem w="full" h="4xs" rounded="md" bg="primary" />
  <GridItem w="full" h="4xs" rounded="md" bg="secondary" />
  <GridItem w="full" h="4xs" rounded="md" bg="warning" />
  <GridItem w="full" h="4xs" rounded="md" bg="danger" />
</SimpleGrid>
Copied!

GitHubでこのページを編集する

GridSpacer