Facilities and components for writing desktop applications with the Compose Multiplatform framework.
Add a dependency to the library as follows:
dependencies {
implementation("io.spine.chords:spine-chords-core:$chordsVersion")
}
Below is a high-level overview of what is included in the module for a quick start. You can also study the references for a more detailed documentation on respective topics.
Provides an API that simplifies creating Compose desktop applications that follow a multiview UI organization.
Although many components in Chords libraries do not depend on how the application is created on a high level, some components (particularly in the Spine Chords Client library) expect that the application is created using this Application Shell API.
See appshell/README.md for details.
As an alternative to writing components as @Composable
functions, as is
typical in Compose, this library also adds a possibility to write components
as classes. This adds certain possibilities for writing and using Compose
components, while still maintaining an experience of using such components
that is very similar to using regular function-based ones.
This approach doesn't replace the function-based components, but adds a possibility to write components using an object-oriented paradigm whenever that appears more appropriate, while using such components interchangeably with the usual function-based ones. The syntax of using such components is similar that of function-based ones.
See the documentation for the Component class for details.
The library introduces its own notion of an input component that is represented by the InputComponent class. Having such a common basis for input components standardizes the API that is expected from all input components, and allows reusing it via class inheritance without having to repeat it for each implementation.
Such a standardized API is in particular useful for a polymorphic (uniform) usage of different input components in components like input forms, which have to be configured with arbitrary sets of input components.
See the InputComponent class, which includes such things as the property for edited value, validation support, etc.
This is a subclass of InputComponent
, which simplifies creating input
components for entering arbitrary value types in text form. It includes support
for such aspects of entry as customizable parsing and formatting of respective
value types, input text validation, etc.
See the InputField documentation for details.
DropdownSelector is a base class for creating another type of input components, where item selection should be performed using a drop-down list.
In addition to components, the library includes such facilities:
-
A simple API to declare and detect key combinations, like this:
if (keyEvent matches 'x'.key.typed) { /*...*/ }
or
Modifier.on(Ctrl(Enter.key).up) { /*...*/ }
See the Keystroke class.
-
Extension functions to address common tasks or current shortcomings in Compose, like ensuring the usual focus traversal with the Tab key for text fields (see Modifier.moveFocusOnTab()).
-
Some simple components that address common needs like CheckboxWithText, RadioButtonWithText, or WithTooltip.
-
More complex components like Wizard.