Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jb1905/fluentui-react-grid

🚧 React components for Fluent UI layout styles
https://github.com/jb1905/fluentui-react-grid

col components fluent grid layout library microsoft react row styles ui

Last synced: 11 days ago
JSON representation

🚧 React components for Fluent UI layout styles

Awesome Lists containing this project

README

        

# [fluentui-react-grid](https://github.com/JB1905/fluentui-react-grid)

[![NPM version](https://img.shields.io/npm/v/fluentui-react-grid?style=flat-square)](https://www.npmjs.com/package/fluentui-react-grid)
[![NPM downloads](https://img.shields.io/npm/dm/fluentui-react-grid?style=flat-square)](https://www.npmjs.com/package/fluentui-react-grid)
[![NPM license](https://img.shields.io/npm/l/fluentui-react-grid?style=flat-square)](https://www.npmjs.com/package/fluentui-react-grid)
[![Codecov](https://img.shields.io/codecov/c/github/JB1905/fluentui-react-grid?style=flat-square)](https://codecov.io/gh/JB1905/fluentui-react-grid)
[![Travis](https://img.shields.io/travis/com/JB1905/fluentui-react-grid/main?style=flat-square)](https://app.travis-ci.com/github/JB1905/fluentui-react-grid)
[![Bundle size](https://img.shields.io/bundlephobia/min/fluentui-react-grid?style=flat-square)](https://bundlephobia.com/result?p=fluentui-react-grid)

## About

React components for Fluent UI layout styles

### Demo

[**Playground – play with the library in Storybook**](https://jb1905.github.io/fluentui-react-grid/)

### Alternatives

- [Fluent UI styles](https://developer.microsoft.com/en-us/fluentui#/styles/web/layout)

## Contents

- [How to Install](#how-to-install)
- [Components](#components)
- [Grid](#grid)
- [Row](#row)
- [Col](#col)
- [Example](#example)

## How to Install

First, install the library in your project by npm:

```sh
$ npm install fluentui-react-grid
```

Or Yarn:

```sh
$ yarn add fluentui-react-grid
```

You also need to include CSS styles (in the HTML header section, e.g. in index.html):

```html

```

## Getting Started

**Import the default component and use it as Compound Component:**

```jsx
import Grid from 'fluentui-react-grid';

// ...

const App = () => {
return (


Col content here...
{/* ... */}

{/* ... */}

);
};

// ...
```

**Or import all components:**

```jsx
import { Grid, Row, Col } from 'fluentui-react-grid';

// ...

const App = () => {
return (


Col content here...
{/* ... */}

{/* ... */}

);
};

// ...
```

## Components

### Grid

#### Available options

[HTML div element props](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes)

_By default grid order is `dir="ltr"` – (order from left to right). You can change it to `dir="rtl"` – (right to left/reversed order) or set `dir="auto"` to remove (it will break the layout)_

### Row

#### Available options

[HTML div element props](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes)

### Col

#### Available options

[HTML div element props](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes) and dedicated params based on Fluent UI class names

[Check corresponding Fluent UI class names here](https://developer.microsoft.com/en-us/fluentui#/styles/web/layout)

| Name | Type |
| ----------------- | ------------------------------- |
| **sizeSm** | number or string (between 1-12) |
| **sizeMd** | number or string (between 1-12) |
| **sizeLg** | number or string (between 1-12) |
| **sizeXl** | number or string (between 1-12) |
| **sizeXxl** | number or string (between 1-12) |
| **sizeXxxl** | number or string (between 1-12) |
| **smPush** | number or string (between 1-12) |
| **mdPush** | number or string (between 1-12) |
| **lgPush** | number or string (between 1-12) |
| **xlPush** | number or string (between 1-12) |
| **xxlPush** | number or string (between 1-12) |
| **xxxlPush** | number or string (between 1-12) |
| **smPull** | number or string (between 1-12) |
| **mdPull** | number or string (between 1-12) |
| **lgPull** | number or string (between 1-12) |
| **xlPull** | number or string (between 1-12) |
| **xxlPull** | number or string (between 1-12) |
| **xxxlPull** | number or string (between 1-12) |
| **hiddenSm** | boolean |
| **hiddenMd** | boolean |
| **hiddenMdDown** | boolean |
| **hiddenMdUp** | boolean |
| **hiddenLg** | boolean |
| **hiddenLgDown** | boolean |
| **hiddenLgUp** | boolean |
| **hiddenXl** | boolean |
| **hiddenXlDown** | boolean |
| **hiddenXlUp** | boolean |
| **hiddenXxl** | boolean |
| **hiddenXxlDown** | boolean |
| **hiddenXxlUp** | boolean |
| **hiddenXxxl** | boolean |

## Example

### Basics

```jsx



A


B

```

### Inheritance

```jsx



Example

```

### Push and pull

```jsx



First in code


Second in code

```

### Visibility

```jsx



Visible on smaller screens


Visible on larger screens

```

### Without Compound Components

```jsx



A


B

```

## License

This project is licensed under the MIT License © 2020-present Jakub Biesiada