Skip to content

Commit bf6984f

Browse files
balatclaude
andcommitted
Ot_form: add reactive_fieldset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1440e63 commit bf6984f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/widgets/ot_form.eliom

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,12 @@ let%shared int_input ?(min = 0) ?(max = max_int) ?(size = 2) initial_value =
822822
in
823823
buttons, value
824824

825+
(* -- Reactive fieldset ------------------------------------------- *)
826+
827+
let%shared reactive_fieldset ?(a = []) ~disabled content =
828+
let a = (a :> Html_types.fieldset_attrib attrib list) in
829+
F.fieldset ~a:(R.filter_attrib (a_disabled ()) disabled :: a) content
830+
825831
(* -- Date and time inputs ---------------------------------------- *)
826832

827833
let%shared parse_date s =

src/widgets/ot_form.eliomi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,16 @@ val%shared validate_as_int : string -> (int option, unit) result
320320
val%shared none_input_value : string
321321
(** The string ["-"], used as placeholder for empty optional int inputs. *)
322322

323+
(** {3 Reactive fieldset} *)
324+
325+
val%shared reactive_fieldset :
326+
?a:[< Html_types.fieldset_attrib] attrib list
327+
-> disabled:bool Eliom_shared.React.S.t
328+
-> [< Html_types.fieldset_content] elt list
329+
-> [> `Fieldset] elt
330+
(** A fieldset that can be reactively disabled.
331+
When disabled, all form elements inside are disabled by the browser. *)
332+
323333
(** {3 Date and time inputs} *)
324334

325335
val%shared parse_date : string -> (int * int * int) option

0 commit comments

Comments
 (0)