UI/MenuSystem/Pages/SettingsPageSetting.razor
@using Sandbox.UI
@using Sandbox

@inherits Panel
@namespace Opium.UI

<root>
    @if ( Description is not null )
    {
        <div class="column">
            <label class="name">@Description.Title</label>
            <label class="description">@Description.Description</label>
        </div>

        @if ( Description.PropertyType == typeof( bool ) )
        {
            <Checkbox Value:bind=@Value />
        }

        @if ( Description.PropertyType == typeof( float ) )
        {
            @if ( Range is not null )
            {
                <OpiumSlider class="devslider" Value:bind=@Value [email protected] [email protected] [email protected] ShowTextEntry="@true" />
            }
            else
            {
                <OpiumSlider class="devslider" Value:bind=@Value />
            }
        }
    }
    else
    {
        <label class="name">???</label>
    }
</root>

@code
{
    public object Target { get; set; }
    public object Value
    {
        get => Description.GetValue( Target );
        set
        {
            Description.SetValue( Target, value );   
        }
    }
    public PropertyDescription Description { get; set; }

    public RangeAttribute Range => Description.GetCustomAttribute<RangeAttribute>();
}