GithubHelp home page GithubHelp logo

ml-archive / bootstrap Goto Github PK

View Code? Open in Web Editor NEW
14.0 9.0 3.0 172 KB

A Leaf wrapper for Bootstrap ๐Ÿƒ

License: MIT License

Swift 100.00%
swift vapor server-side-swift leaf bootstrap vapor-3

bootstrap's Introduction

Bootstrap ๐Ÿƒ

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

This package wraps Bootstrap elements into convenient Leaf-Tags.

Installation

Add Bootstrap to the package dependencies (in your Package.swift file):

dependencies: [
    ...,
    .package(url: "https://github.com/nodes-vapor/bootstrap.git", from: "4.0.0")
]

as well as to your target (e.g. "App"):

targets: [
    ...
    .target(
        name: "App",
        dependencies: [... "Bootstrap" ...]
    ),
    ...
]

Getting started ๐Ÿš€

First import Bootstrap and Leaf inside your configure.swift

import Bootstrap
import Leaf

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?)

Card

#bs:card(title?, classExtras?, attributes?) { <card body> }

or

#bs:card:outer(title?, classExtras?, attributes?) {
	#bs:card:header(classExtras?, attributes?) { <card header, if more than a simple string should be rendered> }
	#bs:card:body(classExtras?, attributes?) { <card contents> }
	#bs:card:footer(classExtras?, attributes?) { <card footer> }
}

๐Ÿ† Credits

This package is developed and maintained by the Vapor team at Nodes.

๐Ÿ“„ License

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

bootstrap's People

Contributors

cweinberger avatar emarashliev avatar khoogheem avatar martinlasek avatar mrmage avatar rasmusebbesen avatar siemensikkema avatar steffendsommer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootstrap's Issues

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.