API reference

Javelit makes it easy for you to visualize, mutate, and share data. The API reference is organized by activity type, like displaying data or optimizing performance. Each section includes methods associated with the activity type, including examples.

Browse our API below and click to learn more about any of our available commands! šŸŽˆ


screenshot

Markdown

Display string formatted as Markdown.

Jt.markdown("Hello **world**!").use();
screenshot

Title

Display text in title formatting.

Jt.title("The app title").use();
screenshot

Header

Display text in header formatting.

Jt.header("This is a header").use();
screenshot

Subheader

Display text in subheader formatting.

Jt.subheader("This is a subheader").use();
screenshot

Code block

Display a code block with optional syntax highlighting.

Jt.code("a = 1234").use();
screenshot

Preformatted text

Write fixed-width and preformatted text.

Jt.text("Hello world").use();
screenshot

Divider

Display a horizontal rule.

Jt.divider("div-1").use();

Render HTML

Render an HTML string in your app.

Jt.html("<p>Foo bar.</p>").use();

screenshot

Static tables

Display a static table.

Jt.table(my_data).use();

screenshot

ECharts

Display a chart using the Apache ECharts library.

Jt.echarts(myChartConfig).use();

screenshot

Button

Display a button widget.

boolean clicked = Jt.button("Click me").use();
screenshot

Form button

Display a form submit button. For use with Jt.form.

boolean submitted = Jt.formSubmitButton("Sign up").use();
screenshot

Page link

Display a link to another page in a multipage app.

Jt.pageLink("/dashboard").use(); Jt.pageLink("/users").label("See Users").use(); // external page Jt.pageLink("https://github.com/javelit/javelit", "Github project").icon(":link:").use();
screenshot

Checkbox

Display a checkbox widget.

boolean selected = Jt.checkbox("I agree").use();
screenshot

Radio

Display a radio button widget.

String choice = Jt.radio("Pick one", List.of("cats", "dogs")).use();
screenshot

Selectbox

Display a select widget.

choice = st.selectbox("Pick one", ["cats", "dogs"])
screenshot

Toggle

Display a toggle widget.

boolean activated = Jt.toggle("Activate").use();
screenshot

Number input

Display a numeric input widget.

Number choice = Jt.numberInput("Pick a number").use();
screenshot

Slider

Display a slider widget.

int number = Jt.slider("Pick a number").use();
screenshot

Date input

Display a date input widget.

LocalDate date = Jt.dateInput("Your birthday").use();
screenshot

Text-area

Display a multi-line text input widget.

String text = Jt.textArea("Text to translate").use();
screenshot

Text input

Display a single-line text input widget.

String name = Jt.textInput("First name").use();
screenshot

Audio input

Display a widget that allows users to record with their microphone.

speech = Jt.audioInput("Record a voice message").use();
screenshot

File uploader

Display a file uploader widget.

UploadedFile data = Jt.fileUploader("Upload a CSV").use();

screenshot

Image

Display an image or list of images.

Jt.image(byteArray).use(); Jt.image(Path.of("image.jpg")).use(); Jt.image("https://example.com/myimage.jpg").use();
screenshot

PDF

Display a PDF file.

Jt.pdf(byteArray).use(); Jt.pdf(Path.of("document.pdf")).use(); Jt.pdf("https://example.com/mydocument.pdf").use();
screenshot

Audio

Display an audio player.

Jt.audio(byteArray).use(); Jt.audio(file).use(); Jt.audio("https://example.com/myaudio.mp3").use();

screenshot

Columns

Insert containers laid out as side-by-side columns.

var cols = Jt.columns(2).use(); Jt.text("This is column 1").use(cols.col(0)); Jt.text("This is column 2").use(cols.col(1));
screenshot

Container

Insert a multi-element container.

var c = Jt.container().use(); Jt.text("This will show last").use(); Jt.text("This will show first").use(c); Jt.text("This will show second").use(c);
screenshot

Empty

Insert a single-element container.

var e = Jt.empty("my-empty").use(); Jt.text("This will show last").use(); Jt.text("This will be replaced").use(e); Jt.text("This will show first").use(e);
screenshot

Expander

Insert a multi-element container that can be expanded/collapsed.

var exp = Jt.expander("Open to see more").use(); Jt.text("This is more content").use(exp);
screenshot

Popover

Insert a multi-element popover container that can be opened/closed.

var pop = Jt.popover("Settings").use(); Jt.checkbox("Show completed").use(pop);
screenshot

Tabs

Insert containers separated into tabs.

var tabs = Jt.tabs(List.of("Tab 1", "Tab 2")).use(); Jt.text("This is tab 1").use(tabs.tab(0)); Jt.text("This is tab 2").use(tabs.tab(1));

screenshot

Success box

Display a success message.

Jt.success("Match found!").use();
screenshot

Info box

Display an informational message.

Jt.info("Dataset is updated every day at midnight.").use();
screenshot

Warning box

Display warning message.

Jt.warning("Unable to fetch image. Skipping...").use();
screenshot

Error box

Display error message.

Jt.error("We encountered an error").use();

screenshot

Navigation

Configure the available pages in a multipage app.

var currentPage = Jt.navigation( Jt.page("/dashboard", DashboardPage::app).title("Home").home(), Jt.page("/users", () -> users()).icon("šŸ‘„"), Jt.page("/queries", () -> {Jt.title("Queries").use(); ...})) .use(); currentPage.run();
screenshot

Page

Define a page in a multipage app.

Jt.page("/settings", () -> settings()) .title("Settings") .icon(":settings:");
screenshot

Page link

Display a link to another page in a multipage app.

Jt.pageLink("/dashboard").use(); Jt.pageLink("/users").label("See Users").use(); // external page Jt.pageLink("https://github.com/javelit/javelit", "Github project").icon(":link:").use();

Switch page

Programmatically navigates to a specified page.

Jt.switchPage("/users"); // go home Jt.switchPage(null);

Forms

Create a form that batches elements together with a "Submit" button.

var form = Jt.form().use(); String name = Jt.textInput("Name").use(form); String email = Jt.textInput("Email").use(form); boolean submitted = Jt.formSubmitButton("Sign up").use(form);

Rerun script

Rerun the script immediately.

Jt.rerun()

HTML

Render an HTML string in your app.

Jt.html("<p>Foo bar.</p>").use();

App Testing

Learn how to test your Javelit applications with unit tests, integration tests, and automated testing frameworks. Ensure your apps work correctly across different scenarios and user interactions.

@Test public void testButtonIsVisible() { PlaywrightUtils.runInSharedBrowser(testInfo, app, page -> { assertThat(page.locator("jt-button").first()).isVisible(WAIT_1_SEC_MAX); }); }
forum

Still have questions?

Go to our discussions forum for helpful information and advice from Javelit experts.