sveltestrap

Bootstrap 4 components for Svelte

  • 所有者: bestguy/sveltestrap
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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:

  • Popover
    • PopoverContent
    • PopoverTitle
  • Tooltip

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

主要指標

概覽
名稱與所有者bestguy/sveltestrap
主編程語言Svelte
編程語言HTML (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2017-03-19 15:46:26
推送於2024-01-07 09:50:10
最后一次提交2023-12-22 19:13:15
發布數155
最新版本名稱v5.11.3 (發布於 2023-12-22 19:13:15)
第一版名稱v0.2.0 (發布於 2017-03-21 22:01:22)
用户参与
星數1.3k
關注者數33
派生數183
提交數1.1k
已啟用問題?
問題數275
打開的問題數102
拉請求數248
打開的拉請求數22
關閉的拉請求數44
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?