# j-RadioButton

> j-RadioButton: for custom design you can use j-RadioButtonExpert; now you can use datasource

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 475c79010ff2d9387edc39db83d5a5f471e5d65ffdb8b884419ec94ff5eaf71a
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- for custom design you can use __j-RadioButtonExpert__
- now you can use datasource

__Configuration__:

- `items` {String} needs to contain `text 1|value 1;text 2|value 2` or `text 1;text 2`
- `required` {Boolean} enables `required`
- `disabled` {Boolean} disables this control
- `label` {String} can change the content (default: `innerHTML`)
- `type` {String} can contain `number`
- `inline` {Boolean} enables/disables inline position (default: `true`)
- `datasource` {String} path to data-source (must be array or array of objects)
- `text` {String} determines a property name for text (in data-source), default: `name`
- `value` {String} determines a property name for value (in data-source) default: `id`

Use it with `<ui-component name="radiobutton">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="radiobutton" path="model.myvalue1" config="items:Yes|0,No|1,Maybe|2;type:number;required:true;inline:0" default="0">Are you crazy?</ui-component>
<br />
<ui-component name="radiobutton" path="model.myvalue2" config="datasource:frameworks;required:true">What is the best node.js framework?</ui-component>
<br />
<ui-component name="radiobutton" path="model.myvalue3" config="datasource:list;required:true">Total.js is framework for...</ui-component>

<script type="text/javascript">
	var frameworks = ['Total.js', 'express', 'Hapi', 'Koa', 'Sails'];
	var list = [{ name: 'Ruby', id: 1 }, { name: 'PHP', id: 2 }, { name: 'node.js', id: 3 }, { name: 'Python', id: 4 }];
</script>
```
