Swiftpack.co - Package - nodes-vapor/bootstrap

Bootstrap 🍃

Swift Version Vapor Version Circle CI codebeat badge codecov Readme Score GitHub license

This package wraps Bootstrap elements into convenient Leaf-Tags.

Installation

Update your Package.swift file.

.package(url: "https://github.com/nodes-vapor/bootstrap.git", from: "1.0.0")

Getting started 🚀

First import Bootstrap and Leaf inside your configure.swift

import Bootstrap
import Leaf

Adding the provider

try services.register(BootstrapProvider())

Adding the Leaf tags

In order to render the Bootstrap elements, you will need to add the Bootstrap Leaf tags:

public func configure(_ config: inout Config, _ env: inout Environment, _ services: inout Services) throws {
    services.register { _ -> LeafTagConfig in
        var tags = LeafTagConfig.default()
        tags.useBootstrapLeafTags()
        return tags
    }
}

Supported tags

Alert

#bs:alert() { alert text }

Badge

#bs:badge(type?, classExtras?, attributes?) { badge text }

Button

#bs:button(type?, classExtras?, attributes?) { btn text }

Button Group

#bs:buttonGroup(isVertical, classExtras?, Aria?) { }
#bs:buttonGroup(false, "btn-group-sm") {
    #bs:button() { First Option }
    #bs:button("danger") { Second Option}
    #bs:button() { Third Option}
}

Button Toolbar

#bs:buttonToolbar(classExtras?, Aria?) { }
#bs:buttonToolbar() {
    #bs:button() { First Option }
    #bs:button("danger") { Second Option}
    #bs:button() { Third Option}
}

Input

#bs:input(type?, classExtras?, attributes?)

Breadcrumb

#bs:breadcrumb(classExtras?, attributes?) {
  #bs:breadcrumbItem(classExtras?, attributes?) { <a href="/"> Home </a> }
  #bs:breadcrumbItem(classExtras?, attributes?) { Profile }
}

Textarea

#bs:textArea(classExtras?, attributes?, value?)

🏆 Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Martin.

📄 License

This package is open-sourced software licensed under the MIT license

Github

link
Stars: 3
Help us keep the lights on

Used By

Total:

Releases

3.1.0 - Jan 4, 2019

Added

  • FormRadio-Tag
  • FormCheckbox-Tag
  • FormFile-Tag

Changed

  • Input-Tag no longer accepts file type. You can use FormFile-Tag from now on.

3.0.0 - Dec 11, 2018

Changed

  • Correctly specified 4.1 as the minimum required Swift version.

Removed

  • This package no longer uses the MutableLeafTagConfig. Please use useBootstrapLeafTags() for registering this package's Leaf tags (see readme for more info).

2.0.2 - Sep 4, 2018

Added

  • Added support for file as a type for the input tag.

2.0.1 - Aug 29, 2018

Added

  • Tag for a textarea.
  • Added support for hidden as a type for the input tag.

2.0.0 - Jun 21, 2018

Added

  • Tags for generating a breadcrumb.

Changed

  • Uses Sugar's new MutableLeafTagConfig to register the tags.
  • Removed the static tags from the BootstrapProvider.