file
This factory generates a single file selection context.
In there you can create a button with a label, an icon, the position of the icon and access its events. For a detailed overview about the possible properties of the button component object itself, have a look at PushButtonComponent
The File function then returns a Flow of File in order to combine the Flow directly to a fitting handler which accepts a File:
val textFileStore = object : RootStore<String>("") {
val upload = handle<File> { _, file -> file.content }
}
file {
accept("text/plain")
encoding("utf-8")
button(id = "myFile") {
text("Select a file")
}
} handledBy textFileStore.upload
Return
a Flow that offers the selected File
See also
Parameters
optional CSS class that should be applied to the element
a lambda expression for setting up the component itself. Details in PushButtonComponent
the ID of the element
the prefix for the generated CSS class resulting in the form `$prefix-$hash`
a lambda expression for declaring the styling as fritz2's styling DSL