# Advanced Features

Examples showcasing conditional logic, dynamic fields, and complex forms.

## Files

### Conditional Logic
- **conditional_form.toml** - Fields that show/hide based on conditions
- **conditional_sections.toml** - Sections visible based on form state
- **conditional_required_demo.rs** - Programmatic example with conditional validation

### Dynamic Display
- **display_items_demo.toml** - Complex item rendering and formatting

## Usage

### TOML Forms (CLI/Web)
```bash
# CLI
cargo run --example conditional_form

# Web
cargo run -p typedialog-web -- --config conditional_form.toml
```text

### Rust Examples (with full control)
```bash
cargo run --example conditional_required_demo
```text

## Features Demonstrated

- **Conditional visibility** - Show/hide fields based on other fields
- **Conditional requirements** - Change validation rules dynamically
- **Section collapsing** - Organize complex forms hierarchically
- **Custom display logic** - Complex field rendering
- **State management** - Track form state and dependencies

## Patterns

### Conditional Field Example
```toml
[fields.experience]
type = "select"
label = "Experience Level"
options = ["Junior", "Senior"]

[fields.years]
type = "number"
label = "Years of Experience"
visible_when = { experience = "Senior" }
required_when = { experience = "Senior" }
```text

### Conditional Section Example
```toml
[sections.advanced_options]
visible_when = { show_advanced = true }

[sections.advanced_options.fields.custom_setting]
type = "text"
```text
