# StyleBuilder

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-view/prelude/style/struct-stylebuilder/

**struct** · [`ferroui-view`](/docs/0.5.0/api/ferroui-view/) · v0.5.0

```rust
struct StyleBuilder
```

A style being built: a selector, setters and nested styles. Turns into a
`Style` of the styles API of the port (`build`), or is
given to an element (`styles: [..]` in `rsx!`, `.styles([..])`).

```ignore
style("Button.accent")
    .set(Button::background_property(), "#0063B1")
    .set(Button::foreground_property(), "White")
    .nested(style("^:pointerover").set(Button::opacity_property(), 0.9))
```

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/style.rs#L18)

## Members

- [`set`](#function-set)
- [`nested`](#function-nested)
- [`build`](#function-build)

<a id="function-set"></a>

### set

```rust
fn set<P: TypedProperty + ?Sized>(self: Self, property: &'static P, value: impl IntoValue<<P as >::Value>) -> Self
```

Sets `property` to `value` (what converts to its value: `"Red"` for a
brush, `8.0` for a thickness).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/style.rs#L56)

<a id="function-nested"></a>

### nested

```rust
fn nested(self: Self, style: StyleBuilder) -> Self
```

Adds a nested style, whose selector starts with `^` (the selector of
this one): `style("^:pointerover")`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/style.rs#L63)

<a id="function-build"></a>

### build

```rust
fn build(self: Self) -> Ref<Style>
```

The style.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/style.rs#L69)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`IntoValue<T>`](/docs/0.5.0/api/ferroui-view/builder/trait-intovalue/)
- [`IntoProp<T, Value>`](/docs/0.5.0/api/ferroui-view/builder/trait-intoprop/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
