# Element

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-view/element/enum-element/

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

```rust
enum Element
```

A description of user interface: a control with its properties and
children, text, several elements, a list that follows state, or a control
that exists already.

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

## Members

- [`Empty`](#variant-empty)
- [`Control`](#variant-control)
- [`Text`](#variant-text)
- [`Fragment`](#variant-fragment)
- [`List`](#variant-list)
- [`Dynamic`](#variant-dynamic)
- [`Existing`](#variant-existing)
- [`Component`](#variant-component)
- [`mount`](#function-mount)
- [`mount_root`](#function-mount_root)
- [`key`](#function-key)

<a id="variant-empty"></a>

### Empty

```rust
Empty
```

Nothing.

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

<a id="variant-control"></a>

### Control

```rust
Control(Box<ControlElement>)
```

A control.

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

<a id="variant-text"></a>

### Text

```rust
Text(std::rc::Rc<str>)
```

Text: the text of the content of its parent, or a `TextBlock` where a
control is needed.

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

<a id="variant-fragment"></a>

### Fragment

```rust
Fragment(Vec<Element>)
```

Several elements in place of one.

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

<a id="variant-list"></a>

### List

```rust
List(Vec<Element>)
```

The elements of an iteration (`for` in `rsx!`, a `Vec`): a fragment
whose items are checked for keys in debug builds.

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

<a id="variant-dynamic"></a>

### Dynamic

```rust
Dynamic(DynamicChildren)
```

Children that follow reactive state.

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

<a id="variant-existing"></a>

### Existing

```rust
Existing(ferroui_base::Ref<ferroui_controls::Control>)
```

A control made elsewhere (a XAML user control, a control kept by the
application).

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

<a id="variant-component"></a>

### Component

```rust
Component(ComponentElement)
```

A component that runs again (see `rerender`).

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

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

### mount

```rust
fn mount(self: Self) -> Ref<Control>
```

Mounts the element as a control: creates the controls of the tree,
gives them their values and children, attaches their handlers and
starts the effects of their reactive values and the components that
run again. The effects belong to the current owner (see `Owner`):
disposing it stops them.

Text becomes a `TextBlock`, and several elements a `StackPanel`.
## Panics
Panics for an empty element or a dynamic list, which have no control
of their own.

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

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

### mount_root

```rust
fn mount_root(self: Self) -> (Ref<Control>, Owner)
```

Mounts the element under a new owner of its own, which is disposed
when the returned owner is: the root of a window or of a piece of user
interface that ends on its own.

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

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

### key

```rust
fn key(self: &Self) -> Option<&Key>
```

The key of the element, if it has one.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`IntoValue<T>`](/docs/0.5.0/api/ferroui-view/builder/trait-intovalue/)
- [`FromValue<T>`](/docs/0.5.0/api/ferroui-view/builder/trait-fromvalue/)
- [`FromValue<Option<T>>`](/docs/0.5.0/api/ferroui-view/builder/trait-fromvalue/)
- [`IntoProp<T, Value>`](/docs/0.5.0/api/ferroui-view/builder/trait-intoprop/)
- [`IntoProp<Option<Rc<dyn AnyValue>>, FromElement>`](/docs/0.5.0/api/ferroui-view/builder/trait-intoprop/)
- [`IntoProp<Option<Ref<T>>, FromControlElement>`](/docs/0.5.0/api/ferroui-view/builder/trait-intoprop/)
- [`IntoChild`](/docs/0.5.0/api/ferroui-view/element/trait-intochild/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `From<El<T>>`
- `Clone`
- `Default`
- `Debug`
- [`IntoElement`](/docs/0.5.0/api/ferroui-view/element/trait-intoelement/)

## Availability

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