# `jsx()` Addon
`jsx()` is a [5th generation](https://github.com/streamich/freestyler/blob/master/docs/en/generations.md#5th-generation)
interface for creating styling blocks — components similar to *"styled components"*,
but which are more powerful.
```jsx
const Button = jsx('button', {
display: 'inline-block',
borderRadius: '3px',
padding: '0.5rem 0',
margin: '0.5rem 1rem',
width: '11rem',
background: 'transparent',
color: 'white',
border: '2px solid white',
});
```
---
> __Nota Bene__
>
> To use this interface you need to provide the hyperscript function `h` of your virtual
> DOM library when creating a `nano-css` instance. In case of React,
> this is the `createElement` function:
>
> ```js
> import {create} from 'nano-css';
> import {createElement} from 'react';
>
> const nano = create({
> h: createElement
> });
> ```
---
Optionally, you can name your styling block:
```js
const Button = jsx('button', css, 'MyButton');
```
Styling blocks pass all their props to the underlying element:
```jsx
```
However, some props have special meaning and are not passed through:
- `css` — a CSS-like object of dynamic style overrides
- `$as` — allows to overwrite the underlying element type
- `$ref` — allows to pass a `ref` to the underlying element
Add custom styling:
```jsx
```
Overwrite underlying element type:
```jsx
// Click me!
```
## Component as a Type
You can pass components as an element type.
```js
const Button = jsx(MyComp, css);
```
where
```jsx
const MyComp = (props) => {
return
};
```
## Composition
The above feature of passing component as a type allows you to do composition.
```js
const BaseButton = jsx('button', {
color: 'red',
border: '1px solid red',
});
const SmallButton = jsx(BaseButton, {
fontSize: '11px',
});
```
However, composition of styling blocks is not something that is encouraged, instead you might
consider using dynamic styling `css` prop:
```jsx
const BaseButton = jsx('button', {
color: 'red',
border: '1px solid red',
});
const Button = (props) => {
const {small, ...rest} = props;
const css = {};
if (small) {
css.fontSize = '11px';
}
return ;
};
```
## Changing Element Type
Let's say you created a `