Giter VIP home page Giter VIP logo

sveltestrap's Introduction

Logo

Bootstrap 4 components for Svelte v3

Work in progress, check back soon - PRs are welcome!

The philosophy of this library is to provide all Bootstrap 4 components for a Svelte app, without needing to use Bootstrap component classes or needing to include Bootstrap's JavaScript.

However, to make using Bootstrap themes easier, this library does not embed Bootstrap styles directly and you will need to include Bootstrap 4 CSS in your page.

The component names and interface are inspired by the reactstrap library for React.

Demo page

Status

  • See component list below
    • Tooltip & Popover are not implemented yet due to lacking Popper/Tether support #31, #32
    • Carousel not implemented yet, need to port transitions/state/key handlers. #30
  • Some stateful components have issues
    • Collapse uses the Svelte slide transistion. In Svelte, the component is removed from the DOM whereas in Bootstrap, it stays in the DOM, but is hidden. This interacts badly with nav bars on small screens.
    • Modal uses Svelte fade transition, which does not use the Bootstrap theme defaults for duration, etc.
  • Most components are missing general DOM events, see #36

Install

npm install --save svelte sveltestrap

Usage

You need to include a link to Bootstrap 4 stylesheet in your page - these components do not include or embed any Bootstrap styles automatically.

Either in your HTML layout:

<head>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>

Or add from your Svelte app:

<svelte:head>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</svelte:head>

In your svelte component:

<script>
  import { Button, Col, Row } from 'sveltestrap';
</script>

<Row>
  <Col>
    <Button color="primary" outline>Hello World!</Button>
  </Col>
</Row>

Note on server-side rendering (SSR) Usage:

If you are using Sveltestrap in an SSR environment like Sapper, it's recommended you import the component source directly, for example:

<script>
  import Button from 'sveltestrap/src/Button.svelte';
  import Col from 'sveltestrap/src/Col.svelte';
  import Row from 'sveltestrap/src/Row.svelte';
</script>

<Row>
  <Col>
    <Button color="primary" outline>Hello World!</Button>
  </Col>
<Row>

Component status

Sveltestrap is currently missing support for the following components:

  • Carousel
    • CarouselCaption
    • CarouselControl
    • CarouselIndicators
    • CarouselItem
  • Popover
    • PopoverContent
    • PopoverTitle
  • Tooltip

Please follow (or help out with) these issues for status:

Missing Carousel (#30) Missing Tooltip (#31) Missing Popover (#32)

sveltestrap's People

Contributors

bestguy avatar gary-mycase avatar frederikhors avatar renerick avatar nextinterfaces avatar daytonlowell avatar larryosborn avatar thebosz avatar dependabot[bot] avatar jlith avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.