kvision / pl.treksoft.kvision.html

Package pl.treksoft.kvision.html

Components supporting complete set of HTML tags, with dedicated classes for buttons, images, links, lists and iframe. Support for Handlebars.js templates is included.

Types

Align

enum class Align

CSS align attributes.

Bold

open class Bold : Tag

Simple component rendered as b.

Button

open class Button : Widget

Button component.

ButtonSize

enum class ButtonSize

Button sizes.

ButtonStyle

enum class ButtonStyle

Button styles.

ButtonType

enum class ButtonType

Button types.

Canvas

open class Canvas : Widget

Canvas component.

Div

open class Div : Tag

Simple component rendered as div.

Footer

open class Footer : Tag

Simple component rendered as footer.

H1

open class H1 : Tag

Simple component rendered as h1.

H2

open class H2 : Tag

Simple component rendered as h2.

H3

open class H3 : Tag

Simple component rendered as h3.

H4

open class H4 : Tag

Simple component rendered as h4.

H5

open class H5 : Tag

Simple component rendered as h5.

H6

open class H6 : Tag

Simple component rendered as h6.

Header

open class Header : Tag

Simple component rendered as header.

Icon

open class Icon : Tag

Icon component with support for FontAwesome and Bootstrap glyphicons.

Iframe

open class Iframe : Widget

Iframe component.

Image

open class Image : Widget

Image component.

ImageShape

enum class ImageShape

Image shapes.

Link

open class Link : SimplePanel

Link component.

ListTag

open class ListTag : SimplePanel

HTML list component.

ListType

enum class ListType

HTML list types.

Main

open class Main : Tag

Simple component rendered as main.

P

open class P : Tag

Simple component rendered as p.

Sandbox

enum class Sandbox

Iframe sandbox options.

Section

open class Section : Tag

Simple component rendered as section.

Span

open class Span : Tag

Simple component rendered as span.

TAG

enum class TAG

HTML tags.

Tag

open class Tag : SimplePanel, Template

HTML tag component.

Template

interface Template

Handlebars templates helper interface.

Functions

bold

fun Container.bold(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Bold.() -> Unit)? = null): Bold

DSL builder extension function.

button

fun Container.button(text: String, icon: String? = null, style: ButtonStyle = ButtonStyle.PRIMARY, type: ButtonType = ButtonType.BUTTON, disabled: Boolean = false, classes: Set<String> = setOf(), init: (Button.() -> Unit)? = null): Button

DSL builder extension function.

canvas

fun Container.canvas(canvasWidth: Int? = null, canvasHeight: Int? = null, classes: Set<String> = setOf(), init: (Canvas.() -> Unit)? = null): Canvas

DSL builder extension function.

div

fun Container.div(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Div.() -> Unit)? = null): Div

DSL builder extension function.

footer

fun Container.footer(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Footer.() -> Unit)? = null): Footer

DSL builder extension function.

h1

fun Container.h1(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (H1.() -> Unit)? = null): H1

DSL builder extension function.

h2

fun Container.h2(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (H2.() -> Unit)? = null): H2

DSL builder extension function.

h3

fun Container.h3(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (H3.() -> Unit)? = null): H3

DSL builder extension function.

h4

fun Container.h4(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (H4.() -> Unit)? = null): H4

DSL builder extension function.

h5

fun Container.h5(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (H5.() -> Unit)? = null): H5

DSL builder extension function.

h6

fun Container.h6(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (H6.() -> Unit)? = null): H6

DSL builder extension function.

header

fun Container.header(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Header.() -> Unit)? = null): Header

DSL builder extension function.

icon

fun Container.icon(icon: String, init: (Icon.() -> Unit)? = null): Icon

DSL builder extension function.

iframe

fun Container.iframe(src: String? = null, srcdoc: String? = null, name: String? = null, iframeWidth: Int? = null, iframeHeight: Int? = null, sandbox: Set<Sandbox>? = null, classes: Set<String> = setOf(), init: (Iframe.() -> Unit)? = null): Iframe

DSL builder extension function.

image

fun Container.image(src: ResString, alt: String? = null, responsive: Boolean = false, shape: ImageShape? = null, centered: Boolean = false, classes: Set<String> = setOf(), init: (Image.() -> Unit)? = null): Image

DSL builder extension function.

link

fun Container.link(label: String, url: String? = null, icon: String? = null, image: ResString? = null, classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null): Link

DSL builder extension function.

listTag

fun Container.listTag(type: ListType, elements: List<String>? = null, rich: Boolean = false, classes: Set<String> = setOf(), init: (ListTag.() -> Unit)? = null): ListTag

DSL builder extension function.

main

fun Container.main(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Main.() -> Unit)? = null): Main

DSL builder extension function.

p

fun Container.p(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (P.() -> Unit)? = null): P

DSL builder extension function.

section

fun Container.section(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Section.() -> Unit)? = null): Section

DSL builder extension function.

setData

fun <K> Template.setData(obj: K, serializer: SerializationStrategy<K>): Unit
fun <K : Any> Template.setData(obj: K): Unit

Extension function to set serializable object as a template data.

span

fun Container.span(content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), init: (Span.() -> Unit)? = null): Span

DSL builder extension function.

tag

fun Container.tag(type: TAG, content: String? = null, rich: Boolean = false, align: Align? = null, classes: Set<String> = setOf(), attributes: Map<String, String> = mapOf(), init: (Tag.() -> Unit)? = null): Tag

DSL builder extension function.