Skip to content

PersonThing/sveltestrap

 
 

Repository files navigation

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.

In your svelte component:

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

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

Layout

  • Container
  • Col
  • Row

Components

  • Alert
    • UncontrolledAlert
  • Badge
  • Breadcrumb
    • BreadcrumbItem
  • Button
    • ButtonDropdown
    • UncontrolledButtonDropdown
  • ButtonGroup
  • ButtonToolbar
  • Card
    • CardBody
    • CardColumns
    • CardDeck
    • CardFooter
    • CardGroup
    • CardHeader
    • CardImg
    • CardImgOverlay
    • CardLink
    • CardSubtitle
    • CardText
    • CardTitle
  • Carousel
    • CarouselCaption
    • CarouselControl
    • CarouselIndicators
    • CarouselItem
  • Close
  • Collapse
    • UncontrolledCollapse
  • Dropdown
    • DropdownItem
    • DropdownMenu
    • DropdownToggle
    • UncontrolledDropdown
  • Form
    • FormFeedback
    • FormGroup
    • FormText
  • Input
    • CustomInput
  • InputGroup
    • InputGroupAddon
    • InputGroupButtonDropdown
    • InputGroupText
  • Jumbotron
  • Label
  • ListGroup
  • ListGroupItem
    • ListGroupItemAction
  • Media
    • MediaBody
  • Modal
    • ModalBody
    • ModalFooter
    • ModalHeader
  • Nav
    • NavItem
    • NavLink
  • Navbar
    • NavbarBrand
    • NavbarToggler
  • Pagination
    • PaginationItem
    • PaginationLink
  • Popover
    • PopoverContent
    • PopoverTitle
  • Progress
  • Spinner
  • TabContent
  • TabPane
  • Table
  • Toast
    • ToastBody
    • ToastHeader
  • Tooltip

About

Bootstrap 4 components for Svelte

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 77.4%
  • JavaScript 22.6%