rio-labs / rio

WebApps in pure Python. No JavaScript, HTML and CSS needed
https://rio.dev
Apache License 2.0
1.41k stars 43 forks source link

Add `RadioButtons` #97

Open Sn3llius opened 3 months ago

Sn3llius commented 3 months ago

Description

RadioButtons are a type of user interface element that allows users to select one option from a predefined set of options. Unlike checkboxes, which allow for multiple selections, RadioButtons ensure that only one option can be selected at a time. This feature is essential for forms where a single choice is required, such as selecting a payment method, choosing a subscription plan, or specifying a preferred contact method.

Design Guidline

https://m3.material.io/components/radio-button/overview

Suggested Solution

Basic Functionality:

RadioButton(
   options: Mapping[str, T] | Sequence[T],
   header: str = '', # or something similar?
   selected_value: T | None = None
   orientation: Literal["horizontal", "vertical"] = "horizontal",
   is_sensitive: bool = True,
   is_valid: bool = True,
   ...
)

Essentially, it functions like a Dropdown?

Alternatives

No response

Additional Context

No response

Related Issues/Pull Requests

No response

Nirajan1-droid commented 3 months ago

@Sn3llius please assign me :) i think i will start from the design and after confirmation i will start coding.

Sn3llius commented 3 months ago

@Nirajan1-droid hey how are you doing? Feel free to ask if you need any help 👍

Nirajan1-droid commented 3 months ago

ok sure