Package dev.fritz2.components

Types

Link copied to clipboard
open class DropdownComponent : Component<Unit>

This class combines the configuration and rendering of a dropdown.

Link copied to clipboard
open class NavbarComponent : Component<Unit>
Link copied to clipboard
open class PopoverComponent : Component<Unit> , CloseButtonProperty

This class combines the configuration and rendering a popover that floats around a toggle element. The toggle can be any HTMLElement or a fritz2 component. The popover can be containing a header, a content and a footer. All "areas" are optional and it can contain a simple String, a Flow or a RenderContext as well as a fritz2 component. The placement of the popover is configurable.

Functions

Link copied to clipboard
fun RenderContext.alert(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "alert",     build: AlertComponent.() -> Unit)

Creates an alert and renders it right away.

Link copied to clipboard
fun alertToast(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "toast-alert",     build: AlertToastComponent.() -> Unit): SimpleHandler<Unit>

This factory method creates a toast with an alert as it's content that will be shown when the returned handler is triggered, eg. on a button press (similar to toast). The same configuration options as in showAlertToast are provided.

Link copied to clipboard
fun RenderContext.appFrame(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "appFrame",     build: AppFrameComponent.() -> Unit = {})

This component implements a standard responsive layout for web-apps.

Link copied to clipboard
fun ComponentValidationMessage.asAlert(renderContext: RenderContext, build: AlertComponent.() -> Unit = { })

Convenience extension to display a ComponentValidationMessage as an alert.

fun ComponentValidationMessage.asAlert(    styling: BasicParams.() -> Unit = { },     renderContext: RenderContext,     build: AlertComponent.() -> Unit = { })

Convenience extension function to display a ComponentValidationMessage as an alert.

Link copied to clipboard
fun RenderContext.box(    styling: FlexParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "box",     content: Div.() -> Unit): Div

This component represents the simplest layout component possible: A simple `div` that acts as a container for arbitrary content.

Link copied to clipboard
fun RenderContext.card(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "card",     build: CardComponent.() -> Unit)

This factory function creates a CardComponent.

Link copied to clipboard
fun RenderContext.checkbox(    styling: BasicParams.() -> Unit = {},     value: Store<Boolean>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "checkboxComponent",     build: CheckboxComponent.() -> Unit = {}): Label

This component generates a single checkbox. So this component supports the use case to select or deselect an option. If an application has a strong focus on mobile, consider a switch instead!

Link copied to clipboard
fun <T> RenderContext.checkboxGroup(    styling: BasicParams.() -> Unit = {},     items: List<T>,     values: Store<List<T>>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "checkboxGroupComponent",     build: CheckboxGroupComponent<T>.() -> Unit = {}): Div

This component generates a group of checkboxes. So this component should be used if a user should be able to choose multiple values from a list of options.

Link copied to clipboard
fun RenderContext.clickButton(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "click-button",     build: PushButtonComponent.() -> Unit = {}): DomListener<MouseEvent, HTMLButtonElement>

This component generates a simple button.

Link copied to clipboard
fun <T, I> RenderContext.dataTable(    styling: GridParams.() -> Unit = {},     rows: RootStore<List<T>>,     rowIdProvider: (T) -> I,     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = DataTableComponent.prefix,     build: DataTableComponent<T, I>.() -> Unit = {})
fun <T, I> RenderContext.dataTable(    styling: GridParams.() -> Unit = {},     rows: RootStore<List<T>>,     rowIdProvider: (T) -> I,     selection: Store<T?>,     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = DataTableComponent.prefix,     build: DataTableComponent<T, I>.() -> Unit = {})
fun <T, I> RenderContext.dataTable(    styling: GridParams.() -> Unit = {},     rows: RootStore<List<T>>,     rowIdProvider: (T) -> I,     selection: Store<List<T>>,     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = DataTableComponent.prefix,     build: DataTableComponent<T, I>.() -> Unit = {})

This component factory generates a data table.

Link copied to clipboard
fun RenderContext.dropdown(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "dropdown",     build: DropdownComponent.() -> Unit)

Creates a dropdown component.

Link copied to clipboard
fun RenderContext.file(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "file",     build: FileSelectionBaseComponent.() -> Unit = {}): Flow<File>

This factory generates a single file selection context.

Link copied to clipboard
fun RenderContext.files(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "file",     build: FileSelectionBaseComponent.() -> Unit = {}): Flow<List<File>>

This factory generates a multiple file selection context.

Link copied to clipboard
fun RenderContext.flexBox(    styling: FlexParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "flex-box",     scope: ScopeContext.() -> Unit = {},     content: Div.() -> Unit): Div

This component represents a layout component with flex property. That is the `display` property is set to `flex`. Besides that is totally resembles the div component

Link copied to clipboard
fun RenderContext.formControl(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "formControl",     build: FormControlComponent.() -> Unit = {})

This component wraps input elements like inputField, selectField, checkbox, checkboxGroup, radioGroup. It enriches those controls with a describing text or label, an optional helper message and also an optional error message. On top it marks a control as required if that should be exposed.

Link copied to clipboard
fun RenderContext.formGroup(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "formGroup",     build: FormGroupComponent.() -> Unit = {})

This component is meant to act a a grouping component for formControls.

Link copied to clipboard
fun RenderContext.gridBox(    styling: GridParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "grid-box",     scope: ScopeContext.() -> Unit = {},     content: Div.() -> Unit): Div

This component represents a layout component with grid property. That is the `display` property is set to `grid`. Besides that is totally resembles the div component

Link copied to clipboard
fun RenderContext.icon(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = IconComponent.prefix,     build: IconComponent.() -> Unit = {})

This component enables to render an icon. It basically wraps raw SVG images into a nicer API.

Link copied to clipboard
fun RenderContext.inputField(    styling: BasicParams.() -> Unit = {},     value: Store<String>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "inputField",     build: InputFieldComponent.() -> Unit = {}): Input

This component generates a text based input field.

Link copied to clipboard
fun RenderContext.lineUp(    styling: FlexParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "line-up",     build: LineUpComponent.() -> Unit = {}): Div

This layout component enables the horizontal stacking of child components.

Link copied to clipboard
fun RenderContext.linkButton(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "link-button",     build: LinkButtonComponent.() -> Unit = {})

This component generates a simple link button.

Link copied to clipboard
fun RenderContext.menu(    styling: BoxParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "menu",     build: MenuComponent.() -> Unit)

This component creates a menu.

Link copied to clipboard
fun modal(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "modal",     build: ModalComponent.() -> Unit): SimpleHandler<Unit>

This component provides some modal dialog or messagebox. Basically it just offers a `div` that is rendered on a higher z-index than the rest of the application. It uses the reserved segments provided by the dev.fritz2.styling.theme.ZIndices.modal function that are initialized by dev.fritz2.styling.theme.Theme.zIndices. That way the top modal will always have the highest `z-index` and therefore be on top of the screen.

Link copied to clipboard
fun RenderContext.navBar(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "navbar",     build: NavbarComponent.() -> Unit = {})
Link copied to clipboard
fun RenderContext.paper(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "paper",     build: PaperComponent.() -> Unit)

This factory function creates a PaperComponent.

Link copied to clipboard
fun RenderContext.popover(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "popover",     build: PopoverComponent.() -> Unit = {})

Creates a popover component.

Link copied to clipboard
fun Tag<HTMLElement>.popup(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String = "fc2-popup-",     prefix: String = "popup",     build: PopupComponent.() -> Unit): Div

This component creates a popup.

Link copied to clipboard
fun RenderContext.pushButton(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "push-button",     build: PushButtonComponent.() -> Unit = {})

This component generates a simple button.

Link copied to clipboard
fun RenderContext.radio(    styling: BasicParams.() -> Unit = {},     value: Store<Boolean>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "radioComponent",     build: RadioComponent.() -> Unit = {}): Label

This component generates a single radio. So this component supports the use case to select or deselect an option. In general prefer a checkbox for this use case. If an application has a strong focus on mobile, consider a switch instead!

Link copied to clipboard
fun <T> RenderContext.radioGroup(    styling: BasicParams.() -> Unit = {},     items: List<T>,     value: Store<T>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "radioGroupComponent",     build: RadioGroupComponent<T>.() -> Unit = {}): Div

This component generates a group of radio buttons. So this supports the use case to choose one item from a list of options. If there is not much vertical or horizontal space consider a selectField as alternative. If there are lots of option, consider using a typeAhead instead.

Link copied to clipboard
fun <T> RenderContext.selectField(    styling: BasicParams.() -> Unit = {},     items: List<T>,     value: Store<T>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "selectField",     build: SelectFieldComponent<T>.() -> Unit): Label

This function generates a selectField element. So this supports the use case to choose one item from a list of options. If there is enough vertical or horizontal space consider a radioGroup as alternative. If there are lots of option, consider using a typeAhead instead.

Link copied to clipboard
fun showAlertToast(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "toast-alert",     build: AlertToastComponent.() -> Unit)

This factory method creates a toast with an alert as its content and displays it right away. Use alertToast in order to display a toast delayed, e.g. when a button is pressed.

Link copied to clipboard
fun showToast(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "toast",     build: ToastComponent.() -> Unit)

This factory method creates a toast and displays it right away. Use toast in order to display a toast delayed, e.g. when a button is pressed.

Link copied to clipboard
fun RenderContext.slider(    styling: BasicParams.() -> Unit = {},     value: Store<Int>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "slider",     build: SliderComponent.() -> Unit = {}): Div
fun RenderContext.slider(    styling: BasicParams.() -> Unit = {},     value: Int,     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "slider",     build: SliderComponent.() -> Unit = {}): Div

This component generates a slider.

Link copied to clipboard
fun RenderContext.spinner(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "spinner",     build: SpinnerComponent.() -> Unit)

This component generates an animated spinner. The spinner is either pure CSS (just a rotating curved border segment) or icon based.

Link copied to clipboard
fun RenderContext.stackUp(    styling: FlexParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "stack-up",     build: StackUpComponent.() -> Unit = {}): Div

This layout component enables the vertical stacking of child components.

Link copied to clipboard
fun RenderContext.switch(    styling: BasicParams.() -> Unit = {},     value: Store<Boolean>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "switchComponent",     build: SwitchComponent.() -> Unit = {}): Label

This component generates a switch. So this component supports the use case to select or deselect an option. As alternative there is also the checkbox.

Link copied to clipboard
fun RenderContext.textArea(    styling: BasicParams.() -> Unit = {},     value: Store<String>? = null,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "textArea",     build: TextAreaComponent.() -> Unit): TextArea

This component generates a TextArea.

Link copied to clipboard
fun toast(    styling: BasicParams.() -> Unit = {},     baseClass: StyleClass = StyleClass.None,     id: String? = null,     prefix: String = "toast",     build: ToastComponent.() -> Unit): SimpleHandler<Unit>

This factory method creates a toast that will be shown when the returned handler is triggered, eg. on a button press.

Link copied to clipboard
fun StyleParams.tooltip(vararg text: String): BasicParams.() -> Unit
fun StyleParams.tooltip(vararg text: String, tooltipPlacement: TooltipPlacements.() -> Style<BasicParams>): BasicParams.() -> Unit

fun Tag<HTMLElement>.tooltip(vararg text: String, build: TooltipComponent.() -> Unit)

tooltip factory function that allow a terser creation for just static text as tooltip's content.

fun Tag<HTMLElement>.tooltip(    styling: BasicParams.() -> Unit = {},     text: String? = null,     baseClass: StyleClass = StyleClass.None,     id: String = "fc2-tooltip-",     prefix: String = "tooltip",     build: TooltipComponent.() -> Unit): Div

This factory function creates a Tooltip.

Link copied to clipboard
fun RenderContext.typeAhead(    styling: BasicParams.() -> Unit = {},     value: Store<String>? = null,     items: Proposal,     baseClass: StyleClass = StyleClass.None,     id: String? = value?.id,     prefix: String = "typeAhead",     build: TypeAheadComponent.() -> Unit = {}): Input

The typeAhead factory function creates a TypeAheadComponent.