CloseButtonProperty

interface CloseButtonProperty

This interface offers some convenience properties for adding a close button to a component.

If offers the possibilities to:

  • change the styling of the default appearance

  • decide whether there is a close button or not

  • change the whole rendering by a custom implementation

Example integration:

open class MyComponent : Component<Unit>, CloseButtonProperty by CloseButtonMixin(ComponentProperty{})  {
// ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
// implement interface delegate to inject empty custom
// mixin styling
override fun render(/* params omitted */) {
div {
// check if closeButton is needed and render it then
if (hasCloseButton.value) {
closeButtonRendering.value(this) handledBy closeHandler
// ^^^^^^^^^^^^^^^^^^^^^^
// use return value (event)
// to handle it by your closing mechanism
}
}
}
}

For some example usages, have a look at the following components:

See also

ModalComponent
PopoverComponent
ToastComponent

Properties

Link copied to clipboard
abstract val closeButtonIcon: ComponentProperty<Icons.() -> IconDefinition>
Link copied to clipboard
abstract val closeButtonPrefix: String
Link copied to clipboard
abstract val closeButtonRendering: ComponentProperty<RenderContext.() -> DomListener<MouseEvent, HTMLElement>>
Link copied to clipboard
abstract val closeButtonStyle: ComponentProperty<Style<BasicParams>>
Link copied to clipboard
abstract val hasCloseButton: ComponentProperty<Boolean>

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard