mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Renamed Md docs (for ordering)
This commit is contained in:
47
docs_md/03-styles.md
Normal file
47
docs_md/03-styles.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Styles
|
||||
|
||||
## Overview
|
||||
Styles - set of functions and parameters for components to customize their behavior.
|
||||
|
||||
Styles is a table, where key is name of component, and value is style table for this component.
|
||||
|
||||
In component API documentation, you can find the style API for this component. Or just lookup for existing styles and modify them.
|
||||
|
||||
## Usage
|
||||
Setup default druid style for all druid instances via `druid.set_default_style`
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
local my_style = require("my.amazing.style")
|
||||
|
||||
local function init(self)
|
||||
druid.set_default_style(my_style)
|
||||
end
|
||||
```
|
||||
|
||||
Setup custom style to specific druid instance:
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
local my_style = require("my.amazing.style")
|
||||
|
||||
local function init(self)
|
||||
-- This druid instance will be use my_style as default
|
||||
self.druid = druid.new(self, my_style)
|
||||
end
|
||||
```
|
||||
|
||||
Change component style with _set_style_ function
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
local my_style = require("my.amazing.style")
|
||||
|
||||
local function init(self)
|
||||
self.druid = druid.new(self)
|
||||
self.button = self.druid:new_button(self, "node")
|
||||
-- Setup custom style for specific component
|
||||
self.button:set_style(my_style)
|
||||
end
|
||||
```
|
||||
|
||||
## Create custom components
|
||||
Styles is just lua table, so it can be described in just one single file
|
||||
__TODO__
|
Reference in New Issue
Block a user