# haxeui-core **Repository Path**: zygameui/haxeui-core ## Basic Information - **Project Name**: haxeui-core - **Description**: The core library of the HaxeUI framework - - **Primary Language**: Haxe - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-25 - **Last Updated**: 2021-10-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
|
| [](https://travis-ci.org/haxeui/haxeui-openfl) |
| haxeui-kha | `Kha` |
|
| [](https://travis-ci.org/haxeui/haxeui-kha) |
| haxeui-html5 | _`none`_ |
|
| [](https://travis-ci.org/haxeui/haxeui-html5) |
| haxeui-pixijs | `PixiJS` |
|
| [](https://travis-ci.org/haxeui/haxeui-pixijs) |
| haxeui-nme | `NME` |
|
| [](https://travis-ci.org/haxeui/haxeui-nme) |
| haxeui-hxwidgets | `hxWidgets` / `wxWidgets` |
|
| [](https://travis-ci.org/haxeui/haxeui-hxwidgets) |
## Usage
Assuming that `haxeui-core` and the `backend` library have been included in your application, initialising the toolkit and using it should be relatively straight forward:
```haxe
Toolkit.init();
```
The `init` function can take an optional `Dynamic` argument that allows certain options to be passed to the host framework. Please refer to each specific backend on how to use these.
Once the toolkit has been initialised components can be added in one of two ways:
### Adding components using Haxe code
Using HaxeUI components in haxe code is simple and easy:
```haxe
import haxe.ui.components.Button;
import haxe.ui.containers.VBox;
import haxe.ui.core.Screen;
var main = new VBox();
var button1 = new Button();
button1.text = "Button 1";
main.addComponent(button1);
var button2 = new Button();
button2.text = "Button 2";
main.addComponent(button2);
Screen.instance.addComponent(main);
```
_Note: `Screen` was used here as a universal way to add items to the application, this is not required however, if you are using a single framework and are not interested in the cross-framework capabilities of HaxeUI, then you can use something more specific to the target framework (eg: `Lib.current.stage.addChild(main)`)._
### Adding components from markup
It is also possible for HaxeUI to take a user interface definition from a markup language (like XML) and use that to build code similar to above:
```haxe
var main = ComponentMacros.buildComponent("assets/ui/demo/main.xml");
Screen.instance.addComponent(main);
```
If your xml isn't available at compile time you can use `Toolkit.componentFromString`:
```haxe
var main = Toolkit.componentFromString('