Revel
GitHub
GitHub
  • Overview

    • Getting started
    • FAQ
    • Release notes
  • Foundations

    • Meet the standard
    • Accessibility
    • Internationalization
    • Information hierarchy
    • Speed
  • Design

    • Visual principles
    • Colors
    • Space
    • Icons
    • Typography
  • Design tokens
  • Style helpers
  • Content

    • Express your ideas
    • Actionable language
    • Inclusive and accessible language
    • Alternative text
    • Grammar and mechanics
      • Basics
      • Capitalization
      • Dates and units of measurement
      • Punctuation
  • Components

    • Alert
    • Avatar
    • Badge
    • Button
    • Button group
    • Checkbox
    • Date Input
      • dates
      • datetimes
      • ranges
    • Field group
    • File upload
    • Flex
    • Grid
    • Icon
    • Image
    • Input
    • Loader
    • Modal
    • Month picker
    • Pagination
    • Popper
    • Radio
    • Repeater
    • Select
    • Tabs
    • Tile
    • Toast
    • Toggle
  • Directives

    • Click outside
    • Tooltip

Grid

A component based on CSS grid for creating layouts.

Usage

import { RGrid, RGridCell } from "@rebilly/revel";

<r-grid>
    <r-grid-cell span="6">...</r-grid-cell>
    <r-grid-cell span="6">...</r-grid-cell>
</r-grid>

Examples

Basic grid

By default, the grid expands for 12 columns and will wrap to the next row once the combined cells reach 12 spaces (spans) in total. Grid cells will fill the available space in the grid by default.

grid.vue

Keep RGrid columns and RGridCell span equal or lower than 12.

Nested grid

It is possible to nest grids inside each other.

grid-nested.vue

Wrap

Add the wrap property to a RGridCell to make the next cell continue on the next grid row.

grid-wrap.vue

Offset

Add the offset property to a RGridCell to move the cell to the right.

grid-offset.vue

Avoid using RGridCell wrap and RGridCell offset props together.

Responsivess

Grid cells will take full width on breakpoint --r-breakpoints-m.

RGrid

Props

NameTypeDefaultDescription
columnsGridSize'12'

Number of grid columns (1 to 12)

gapGap'6'

Gap between grid columns (0 to 12)

justifyItemsNullable, Distributionnull

Justify items in the grid

alignItemsNullable, Distributionnull

Align items in the grid

jutifyContentNullable, ContentDistributionnull

Justify content in the grid

alignContentNullable, ContentDistributionnull

Align content in the grid

unstackablebooleanfalse

Prevents grid to stack on smaller screens

Slots

NameDescription
default

Grid cell items

RGridCell

Props

NameTypeDefaultDescription
spanNullable, GridSizenull

Number of columns the cell will fill (1 to 12)

justifySelfNullable, Distributionnull

Justify items in the cell

alignSelfNullable, Distributionnull

Align items in the cell

wrapbooleanfalse

Move to the next row

offsetNullable, Offsetnull

Move the cell to the right. E.g "1, 5"

Slots

NameDescription
default

Cell content

Edit this page
Last Updated: 10/4/24, 2:04 PM
Contributors: Dasha Baklanova, John Hannagan, Weetbix, Cesar Level
Prev
Flex
Next
Icon