mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-12-01 16:56:34 +01:00
feat(widgets): update field style
This commit is contained in:
@@ -8,13 +8,36 @@ import {
|
||||
FieldLegend,
|
||||
FieldSeparator,
|
||||
FieldSet,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
TextInput,
|
||||
Widget,
|
||||
} from "@lcui/react";
|
||||
|
||||
const months = [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"05",
|
||||
"06",
|
||||
"07",
|
||||
"08",
|
||||
"09",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
];
|
||||
|
||||
const years = ["2024", "2025", "2026", "2027", "2028", "2029"];
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Widget className="flex flex-col gap-2 max-w-[400px]">
|
||||
<Widget className="flex flex-col gap-5 max-w-[448px] p-1 -m-1">
|
||||
<FieldSet>
|
||||
<FieldLegend>Payment Method</FieldLegend>
|
||||
<FieldDescription>
|
||||
@@ -33,11 +56,37 @@ export default function App() {
|
||||
<div className="flex gap-4">
|
||||
<Field className="flex-1">
|
||||
<FieldLabel htmlFor="card-month">Month</FieldLabel>
|
||||
<TextInput id="card-month" placeholder="MM" />
|
||||
<Select>
|
||||
<SelectTrigger id="card-month">
|
||||
<SelectValue placeholder="MM" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
{months.map((item) => (
|
||||
<SelectItem key={item} value={item}>
|
||||
{item}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Field>
|
||||
<Field className="flex-1">
|
||||
<FieldLabel htmlFor="card-year">Year</FieldLabel>
|
||||
<TextInput id="card-year" placeholder="YYYY" />
|
||||
<Select>
|
||||
<SelectTrigger id="card-year">
|
||||
<SelectValue placeholder="YYYY" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
{years.map((item) => (
|
||||
<SelectItem key={item} value={item}>
|
||||
{item}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Field>
|
||||
<Field className="flex-1">
|
||||
<FieldLabel htmlFor="card-cvv">CVV</FieldLabel>
|
||||
@@ -55,14 +104,14 @@ export default function App() {
|
||||
<FieldGroup>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="billing-same" />
|
||||
<FieldLabel htmlFor="billing-same">
|
||||
<FieldLabel htmlFor="billing-same" className="font-normal">
|
||||
Same as shipping address
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
<Field orientation="horizontal">
|
||||
<Button>Submit</Button>
|
||||
<Button variant="primary">Submit</Button>
|
||||
<Button>Cancel</Button>
|
||||
</Field>
|
||||
</Widget>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo field-basic-demo">
|
||||
<field-set>
|
||||
<field-legend>Payment Method</field-legend>
|
||||
<field-description
|
||||
@@ -17,16 +17,50 @@
|
||||
<field-description
|
||||
>Enter your 16-digit card number</field-description>
|
||||
</field>
|
||||
<div style="display:flex; gap:16px">
|
||||
<field style="flex:1">
|
||||
<div class="field-basic-card-row">
|
||||
<field class="field-basic-card-field">
|
||||
<field-label for="card-month">Month</field-label>
|
||||
<textinput id="card-month" placeholder="MM" />
|
||||
<select>
|
||||
<select-trigger id="card-month">
|
||||
<select-value data-select-placeholder="MM" />
|
||||
</select-trigger>
|
||||
<portal>
|
||||
<select-content>
|
||||
<select-item value="01">01</select-item>
|
||||
<select-item value="02">02</select-item>
|
||||
<select-item value="03">03</select-item>
|
||||
<select-item value="04">04</select-item>
|
||||
<select-item value="05">05</select-item>
|
||||
<select-item value="06">06</select-item>
|
||||
<select-item value="07">07</select-item>
|
||||
<select-item value="08">08</select-item>
|
||||
<select-item value="09">09</select-item>
|
||||
<select-item value="10">10</select-item>
|
||||
<select-item value="11">11</select-item>
|
||||
<select-item value="12">12</select-item>
|
||||
</select-content>
|
||||
</portal>
|
||||
</select>
|
||||
</field>
|
||||
<field style="flex:1">
|
||||
<field class="field-basic-card-field">
|
||||
<field-label for="card-year">Year</field-label>
|
||||
<textinput id="card-year" placeholder="YYYY" />
|
||||
<select>
|
||||
<select-trigger id="card-year">
|
||||
<select-value data-select-placeholder="YYYY" />
|
||||
</select-trigger>
|
||||
<portal>
|
||||
<select-content>
|
||||
<select-item value="2024">2024</select-item>
|
||||
<select-item value="2025">2025</select-item>
|
||||
<select-item value="2026">2026</select-item>
|
||||
<select-item value="2027">2027</select-item>
|
||||
<select-item value="2028">2028</select-item>
|
||||
<select-item value="2029">2029</select-item>
|
||||
</select-content>
|
||||
</portal>
|
||||
</select>
|
||||
</field>
|
||||
<field style="flex:1">
|
||||
<field class="field-basic-card-field">
|
||||
<field-label for="card-cvv">CVV</field-label>
|
||||
<textinput id="card-cvv" placeholder="123" />
|
||||
</field>
|
||||
@@ -42,13 +76,14 @@
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="billing-same" />
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="billing-same"
|
||||
>Same as shipping address</field-label>
|
||||
</field>
|
||||
</field-group>
|
||||
</field-set>
|
||||
<field orientation="horizontal">
|
||||
<button>Submit</button>
|
||||
<button variant="primary">Submit</button>
|
||||
<button>Cancel</button>
|
||||
</field>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,28 @@
|
||||
|
||||
#include <LCUI.h>
|
||||
|
||||
static const char *month_items[12] = { "01", "02", "03", "04", "05", "06",
|
||||
"07", "08", "09", "10", "11", "12" };
|
||||
static const char *year_items[6] = { "2024", "2025", "2026",
|
||||
"2027", "2028", "2029" };
|
||||
|
||||
/* Build a select and point the field label at its real trigger button. */
|
||||
static ui_widget_t *create_select(const char *id, const char *placeholder,
|
||||
const char *const *items, int count)
|
||||
{
|
||||
ui_widget_t *select = ui_create_select();
|
||||
ui_widget_t *button;
|
||||
int i;
|
||||
|
||||
ui_select_set_placeholder(select, placeholder);
|
||||
for (i = 0; i < count; ++i) {
|
||||
ui_select_add_item(select, items[i], items[i]);
|
||||
}
|
||||
button = ui_widget_get_child(ui_widget_get_child(select, 0), 0);
|
||||
ui_widget_set_id(button, id);
|
||||
return select;
|
||||
}
|
||||
|
||||
void field_basic_init(ui_widget_t *parent)
|
||||
{
|
||||
ui_widget_t *outer;
|
||||
@@ -13,8 +35,8 @@ void field_basic_init(ui_widget_t *parent)
|
||||
ui_widget_t *name_field, *name_lbl, *name_input;
|
||||
ui_widget_t *card_field, *card_lbl, *card_input, *card_desc;
|
||||
ui_widget_t *card_row;
|
||||
ui_widget_t *month_field, *month_lbl, *month_input;
|
||||
ui_widget_t *year_field, *year_lbl, *year_input;
|
||||
ui_widget_t *month_field, *month_lbl, *month_select;
|
||||
ui_widget_t *year_field, *year_lbl, *year_select;
|
||||
ui_widget_t *cvv_field, *cvv_lbl, *cvv_input;
|
||||
ui_widget_t *sep;
|
||||
ui_widget_t *set2, *legend2, *desc2, *group2;
|
||||
@@ -36,10 +58,8 @@ void field_basic_init(ui_widget_t *parent)
|
||||
card_row = ui_create_widget(NULL);
|
||||
month_field = ui_create_field();
|
||||
month_lbl = ui_create_field_label();
|
||||
month_input = ui_create_widget("textinput");
|
||||
year_field = ui_create_field();
|
||||
year_lbl = ui_create_field_label();
|
||||
year_input = ui_create_widget("textinput");
|
||||
cvv_field = ui_create_field();
|
||||
cvv_lbl = ui_create_field_label();
|
||||
cvv_input = ui_create_widget("textinput");
|
||||
@@ -51,14 +71,13 @@ void field_basic_init(ui_widget_t *parent)
|
||||
same_field = ui_create_field();
|
||||
same_cb = ui_create_checkbox();
|
||||
same_lbl = ui_create_field_label();
|
||||
ui_widget_add_class(same_lbl, "font-normal");
|
||||
actions = ui_create_field();
|
||||
submit = ui_create_widget("button");
|
||||
cancel = ui_create_widget("button");
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
ui_widget_add_class(outer, "field-basic-demo");
|
||||
|
||||
ui_text_set_content(legend1, "Payment Method");
|
||||
ui_widget_append(set1, legend1);
|
||||
@@ -84,26 +103,23 @@ void field_basic_init(ui_widget_t *parent)
|
||||
ui_widget_append(card_field, card_desc);
|
||||
ui_widget_append(group1, card_field);
|
||||
|
||||
ui_widget_set_style_string(card_row, "display", "flex");
|
||||
ui_widget_set_style_string(card_row, "gap", "16px");
|
||||
ui_widget_set_style_string(month_field, "flex", "1");
|
||||
ui_widget_set_style_string(year_field, "flex", "1");
|
||||
ui_widget_set_style_string(cvv_field, "flex", "1");
|
||||
ui_widget_add_class(card_row, "field-basic-card-row");
|
||||
ui_widget_add_class(month_field, "field-basic-card-field");
|
||||
ui_widget_add_class(year_field, "field-basic-card-field");
|
||||
ui_widget_add_class(cvv_field, "field-basic-card-field");
|
||||
|
||||
ui_label_set_for(month_lbl, "card-month");
|
||||
ui_text_set_content(month_lbl, "Month");
|
||||
ui_widget_append(month_field, month_lbl);
|
||||
ui_textinput_set_placeholder(month_input, "MM");
|
||||
ui_widget_set_id(month_input, "card-month");
|
||||
ui_widget_append(month_field, month_input);
|
||||
month_select = create_select("card-month", "MM", month_items, 12);
|
||||
ui_widget_append(month_field, month_select);
|
||||
ui_widget_append(card_row, month_field);
|
||||
|
||||
ui_label_set_for(year_lbl, "card-year");
|
||||
ui_text_set_content(year_lbl, "Year");
|
||||
ui_widget_append(year_field, year_lbl);
|
||||
ui_textinput_set_placeholder(year_input, "YYYY");
|
||||
ui_widget_set_id(year_input, "card-year");
|
||||
ui_widget_append(year_field, year_input);
|
||||
year_select = create_select("card-year", "YYYY", year_items, 6);
|
||||
ui_widget_append(year_field, year_select);
|
||||
ui_widget_append(card_row, year_field);
|
||||
|
||||
ui_label_set_for(cvv_lbl, "card-cvv");
|
||||
@@ -138,6 +154,7 @@ void field_basic_init(ui_widget_t *parent)
|
||||
|
||||
ui_field_set_orientation(actions, "horizontal");
|
||||
ui_button_set_text(submit, "Submit");
|
||||
ui_button_set_variant(submit, UI_BUTTON_VARIANT_PRIMARY);
|
||||
ui_widget_append(actions, submit);
|
||||
ui_button_set_text(cancel, "Cancel");
|
||||
ui_widget_append(actions, cancel);
|
||||
|
||||
@@ -22,25 +22,37 @@ export default function App() {
|
||||
<FieldGroup className="gap-3">
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="finder-pref-9k2-hard-disks-ljj" defaultChecked />
|
||||
<FieldLabel htmlFor="finder-pref-9k2-hard-disks-ljj">
|
||||
<FieldLabel
|
||||
htmlFor="finder-pref-9k2-hard-disks-ljj"
|
||||
className="font-normal"
|
||||
>
|
||||
Hard disks
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="finder-pref-9k2-external-disks-1yg" />
|
||||
<FieldLabel htmlFor="finder-pref-9k2-external-disks-1yg">
|
||||
<FieldLabel
|
||||
htmlFor="finder-pref-9k2-external-disks-1yg"
|
||||
className="font-normal"
|
||||
>
|
||||
External disks
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="finder-pref-9k2-cds-dvds-fzt" />
|
||||
<FieldLabel htmlFor="finder-pref-9k2-cds-dvds-fzt">
|
||||
<FieldLabel
|
||||
htmlFor="finder-pref-9k2-cds-dvds-fzt"
|
||||
className="font-normal"
|
||||
>
|
||||
CDs, DVDs, and iPods
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="finder-pref-9k2-connected-servers-6l2" />
|
||||
<FieldLabel htmlFor="finder-pref-9k2-connected-servers-6l2">
|
||||
<FieldLabel
|
||||
htmlFor="finder-pref-9k2-connected-servers-6l2"
|
||||
className="font-normal"
|
||||
>
|
||||
Connected servers
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
|
||||
@@ -1,33 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo">
|
||||
<field-set>
|
||||
<field-legend>Show these items on the desktop</field-legend>
|
||||
<field-description
|
||||
>Select the items you want to show on the desktop.</field-description>
|
||||
<field-group style="gap:12px">
|
||||
<field-group class="field-checkbox-demo-group">
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="finder-pref-9k2-hard-disks-ljj" checked="true" />
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="finder-pref-9k2-hard-disks-ljj"
|
||||
>Hard disks</field-label>
|
||||
</field>
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="finder-pref-9k2-external-disks-1yg" />
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="finder-pref-9k2-external-disks-1yg"
|
||||
>External disks</field-label>
|
||||
</field>
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="finder-pref-9k2-cds-dvds-fzt" />
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="finder-pref-9k2-cds-dvds-fzt"
|
||||
>CDs, DVDs, and iPods</field-label>
|
||||
</field>
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="finder-pref-9k2-connected-servers-6l2" />
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="finder-pref-9k2-connected-servers-6l2"
|
||||
>Connected servers</field-label>
|
||||
</field>
|
||||
|
||||
@@ -13,6 +13,7 @@ static void make_check_row(ui_widget_t *parent, const char *id,
|
||||
ui_widget_t *cb = ui_create_checkbox();
|
||||
ui_widget_t *lbl = ui_create_field_label();
|
||||
|
||||
ui_widget_add_class(lbl, "font-normal");
|
||||
ui_field_set_orientation(row, "horizontal");
|
||||
ui_widget_set_id(cb, id);
|
||||
if (checked) {
|
||||
@@ -44,17 +45,14 @@ void field_checkbox_init(ui_widget_t *parent)
|
||||
sync_lbl = ui_create_field_label();
|
||||
sync_desc = ui_create_field_description();
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
|
||||
ui_text_set_content(legend, "Show these items on the desktop");
|
||||
ui_widget_append(set, legend);
|
||||
ui_text_set_content(
|
||||
desc, "Select the items you want to show on the desktop.");
|
||||
ui_widget_append(set, desc);
|
||||
ui_widget_set_style_string(group, "gap", "12px");
|
||||
ui_widget_add_class(group, "field-checkbox-demo-group");
|
||||
ui_widget_append(set, group);
|
||||
|
||||
make_check_row(group, "finder-pref-9k2-hard-disks-ljj", "Hard disks",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo">
|
||||
<field-group>
|
||||
<field-set>
|
||||
<field-label
|
||||
|
||||
@@ -36,10 +36,7 @@ void field_choice_card_init(ui_widget_t *parent)
|
||||
item1 = ui_create_radio_group_item();
|
||||
item2 = ui_create_radio_group_item();
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
|
||||
ui_widget_append(group, set);
|
||||
ui_label_set_for(lbl, "compute-environment");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo">
|
||||
<field-set>
|
||||
<field-legend>Address Information</field-legend>
|
||||
<field-description
|
||||
|
||||
@@ -28,10 +28,7 @@ void field_fieldset_init(ui_widget_t *parent)
|
||||
zip_lbl = ui_create_field_label();
|
||||
zip_input = ui_create_widget("textinput");
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
|
||||
ui_text_set_content(legend, "Address Information");
|
||||
ui_widget_append(set, legend);
|
||||
|
||||
@@ -22,7 +22,9 @@ export default function App() {
|
||||
<FieldGroup>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="push" defaultChecked disabled />
|
||||
<FieldLabel htmlFor="push">Push notifications</FieldLabel>
|
||||
<FieldLabel htmlFor="push" className="font-normal">
|
||||
Push notifications
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
@@ -35,11 +37,15 @@ export default function App() {
|
||||
<FieldGroup>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="push-tasks" />
|
||||
<FieldLabel htmlFor="push-tasks">Push notifications</FieldLabel>
|
||||
<FieldLabel htmlFor="push-tasks" className="font-normal">
|
||||
Push notifications
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<Checkbox id="email-tasks" />
|
||||
<FieldLabel htmlFor="email-tasks">Email notifications</FieldLabel>
|
||||
<FieldLabel htmlFor="email-tasks" className="font-normal">
|
||||
Email notifications
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo">
|
||||
<field-group>
|
||||
<field-set>
|
||||
<field-label>Responses</field-label>
|
||||
@@ -10,7 +10,10 @@
|
||||
<field-group>
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="push" checked="true" disabled="true" />
|
||||
<field-label for="push">Push notifications</field-label>
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="push"
|
||||
>Push notifications</field-label>
|
||||
</field>
|
||||
</field-group>
|
||||
</field-set>
|
||||
@@ -22,11 +25,17 @@
|
||||
<field-group>
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="push-tasks" />
|
||||
<field-label for="push-tasks">Push notifications</field-label>
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="push-tasks"
|
||||
>Push notifications</field-label>
|
||||
</field>
|
||||
<field orientation="horizontal">
|
||||
<checkbox id="email-tasks" />
|
||||
<field-label for="email-tasks">Email notifications</field-label>
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="email-tasks"
|
||||
>Email notifications</field-label>
|
||||
</field>
|
||||
</field-group>
|
||||
</field-set>
|
||||
|
||||
@@ -13,6 +13,7 @@ static void make_check_field(ui_widget_t *parent, const char *id,
|
||||
ui_widget_t *cb = ui_create_checkbox();
|
||||
ui_widget_t *lbl = ui_create_field_label();
|
||||
|
||||
ui_widget_add_class(lbl, "font-normal");
|
||||
ui_field_set_orientation(row, "horizontal");
|
||||
ui_widget_set_id(cb, id);
|
||||
if (checked) {
|
||||
@@ -47,10 +48,7 @@ void field_group_init(ui_widget_t *parent)
|
||||
sub2 = ui_create_field_group();
|
||||
sep = ui_create_field_separator();
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
|
||||
ui_widget_append(group, set1);
|
||||
ui_text_set_content(lbl1, "Responses");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo">
|
||||
<field-set>
|
||||
<field-group>
|
||||
<field>
|
||||
|
||||
@@ -24,10 +24,7 @@ void field_input_init(ui_widget_t *parent)
|
||||
pass_desc = ui_create_field_description();
|
||||
pass_input = ui_create_widget("textinput");
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
|
||||
ui_widget_append(set, group);
|
||||
|
||||
|
||||
@@ -19,17 +19,21 @@ export default function App() {
|
||||
<RadioGroup defaultValue="monthly">
|
||||
<Field orientation="horizontal">
|
||||
<RadioGroupItem value="monthly" id="plan-monthly" />
|
||||
<FieldLabel htmlFor="plan-monthly">
|
||||
<FieldLabel htmlFor="plan-monthly" className="font-normal">
|
||||
Monthly ($9.99/month)
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<RadioGroupItem value="yearly" id="plan-yearly" />
|
||||
<FieldLabel htmlFor="plan-yearly">Yearly ($99.99/year)</FieldLabel>
|
||||
<FieldLabel htmlFor="plan-yearly" className="font-normal">
|
||||
Yearly ($99.99/year)
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<RadioGroupItem value="lifetime" id="plan-lifetime" />
|
||||
<FieldLabel htmlFor="plan-lifetime">Lifetime ($299.99)</FieldLabel>
|
||||
<FieldLabel htmlFor="plan-lifetime" className="font-normal">
|
||||
Lifetime ($299.99)
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
</RadioGroup>
|
||||
</FieldSet>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lcui-app>
|
||||
<ui>
|
||||
<div style="display:flex; flex-direction:column; gap:8px; max-width:400px">
|
||||
<div class="field-demo">
|
||||
<field-set>
|
||||
<field-label>Subscription Plan</field-label>
|
||||
<field-description
|
||||
@@ -9,15 +9,24 @@
|
||||
<radio-group value="monthly">
|
||||
<field orientation="horizontal">
|
||||
<radio-group-item id="plan-monthly" value="monthly" />
|
||||
<field-label for="plan-monthly">Monthly ($9.99/month)</field-label>
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="plan-monthly"
|
||||
>Monthly ($9.99/month)</field-label>
|
||||
</field>
|
||||
<field orientation="horizontal">
|
||||
<radio-group-item id="plan-yearly" value="yearly" />
|
||||
<field-label for="plan-yearly">Yearly ($99.99/year)</field-label>
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="plan-yearly"
|
||||
>Yearly ($99.99/year)</field-label>
|
||||
</field>
|
||||
<field orientation="horizontal">
|
||||
<radio-group-item id="plan-lifetime" value="lifetime" />
|
||||
<field-label for="plan-lifetime">Lifetime ($299.99)</field-label>
|
||||
<field-label
|
||||
class="font-normal"
|
||||
for="plan-lifetime"
|
||||
>Lifetime ($299.99)</field-label>
|
||||
</field>
|
||||
</radio-group>
|
||||
</field-set>
|
||||
|
||||
@@ -28,12 +28,10 @@ void field_radio_init(ui_widget_t *parent)
|
||||
row[i] = ui_create_field();
|
||||
item[i] = ui_create_radio_group_item();
|
||||
row_lbl[i] = ui_create_field_label();
|
||||
ui_widget_add_class(row_lbl[i], "font-normal");
|
||||
}
|
||||
|
||||
ui_widget_set_style_string(outer, "display", "flex");
|
||||
ui_widget_set_style_string(outer, "flex-direction", "column");
|
||||
ui_widget_set_style_string(outer, "gap", "8px");
|
||||
ui_widget_set_style_string(outer, "max-width", "400px");
|
||||
ui_widget_add_class(outer, "field-demo");
|
||||
|
||||
ui_text_set_content(lbl, "Subscription Plan");
|
||||
ui_widget_append(set, lbl);
|
||||
|
||||
Reference in New Issue
Block a user