Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ryu-man/svelte-layouts

Easily structure your page using components
https://github.com/ryu-man/svelte-layouts

css flexbox grid html javascript layout svelte

Last synced: about 1 month ago
JSON representation

Easily structure your page using components

Awesome Lists containing this project

README

        


LAYOUTS



npm version


license

# Layouts

This project is an implementation of CSS Flexbox & Grid for [Svelte](https://svelte.dev/) framework for making it easier for developers to create layouts and build apps faster

## Install

```bash
// npm
npm install svelte-layouts

// yarn
yarn add svelte-layouts
```

## Get started

Layouts have four main components: Row, Col (Column) ,Grid and Item

**Row**: a layout with horizontal main-axis, place it items from left to right

**Col**: a layout with vertical main-axis, place it items from top to left

**Grid**: a multi-directional layout, where items can be positione vertically and horizontally

**Item**: a controllable layout item

## Examples

```html

import { Row, Col, Grid, Item } from 'svelte-layouts'

// control how elements are positioned horizontally

// Create div element, controled with style property

// Create an item

// Create a row item

// Create a Col item

// Create a grid item

// Define the number & width of rows and columns

```

## Responsive Design

```html




```

```css
@media (min-width: 1000px) {
/*
you can target .col , .row, .grid, .item, also you can add .layout class to prevent style collision
or you can target a specific class provided to the component via it class prop
.class :global(.class) syntax is recommended to prevent style leakage
*/
.container :global(.row) {
/*make sure to use !important to override component's inline style*/
background-color: black !important;
}
}
```

## License

svelte-layouts is [MIT Licenced](./LICENSE)

## Learn More

if you want to learn more about css flexbox and grid and how they works, you can feel free to check out these useful links:

- [A Complete Guide to Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)
- [A Complete Guide to Grid](https://css-tricks.com/snippets/css/complete-guide-grid/)
- [Flexbox vs Grid](https://dev.to/nadayousry/grid-vs-flexbox-3fbh)