Method Signatures and Parameters | |
Jt.button(String label) | label (String) A short label explaining to the user what this button is for. Markdown is supported, see |
Chainable builder methods | |
type(String type) | The button appearance type. Can be |
icon(String icon) | An icon to display with the error message. The following values are valid:
null (default), no icon is displayed.
|
help(String help) | A tooltip that gets displayed when the button is hovered over. |
disabled(boolean disabled) | Disable the button if set to true. When disabled, users cannot interact with the widget. |
useContainerWidth(boolean useContainerWidth) | Makes the button fill the width of its container if set to true. |
onClick(function.Consumer<Boolean> onClick) | An optional callback invoked when this button is clicked. The value passed to the callback is the previous value of the component. |
key(String key) | A string to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. |
No description | |
use() | Put the widget in the app, in the |
use(JtContainer container) | Put the widget in the app, in the provided container. |
Returns after .use() | |
(boolean) | The current boolean value of the component. |
Examples
Basic button usage and interaction
import tech.catheu.jeamlit.core.Jt;
public class ButtonApp {
public static void main(String[] args) {
if (Jt.button("Say hello").use()) {
Jt.text("Why hello there").use();
} else {
Jt.text("Goodbye").use();
}
}
}
Still have questions?
Go to our discussions forum for helpful information and advice from Jeamlit experts.