Skip to content

feat: implement 9 W3.CSS helper components (#2, #5, #12, #15, #17, #19, #20, #21, #26)#34

Open
VincentGuyader wants to merge 3 commits intomasterfrom
feat/w3css-helpers-batch
Open

feat: implement 9 W3.CSS helper components (#2, #5, #12, #15, #17, #19, #20, #21, #26)#34
VincentGuyader wants to merge 3 commits intomasterfrom
feat/w3css-helpers-batch

Conversation

@VincentGuyader
Copy link
Copy Markdown
Member

Summary

Replaces the 9 R/todo_w3css_*.R stubs with working implementations. All renderers return htmltools tags compatible with Shiny; class-returning helpers (w3_round, w3_margin) follow the existing w3_color style.

# Component Helper
#2 alerts w3_alert(..., level)<div class="w3-panel w3-COLOR">
#5 code w3_code() + w3_codespan()<pre> / inline <code>
#12 icons w3_icon(name, library) — Font Awesome or W3 set
#15 margins w3_margin(side) — returns the CSS class
#17 notes w3_note(..., level)w3-leftbar pale panel
#19 progressbar w3_progressbar(value) — clamped [0, 100], with role="progressbar" and aria-valuenow / valuemin / valuemax so screen readers announce it correctly
#20 quotes w3_quote(...) — styled <blockquote>
#21 round w3_round(size) — returns the CSS class
#26 tags w3_tag(..., color, round)<span class="w3-tag …">

w3_alert(level = …) accepts the full W3 palette via w3_color() (validation delegated there), instead of being clamped to red/yellow/green/blue.

The 18 remaining R/todo_w3css_*.R stubs (accordions, sidebar, slideshow, navigation, layout, tabulators, checkbox…) need design decisions and were left out.

Test plan

  • tests/testthat/test-todo-batch.R: 47 PASS — class strings, structure, ARIA attributes, value clamp, w3_round/w3_margin exact class outputs, w3_alert accepting any w3_color value.
  • R CMD check: 0 ERROR / 0 WARNING / 0 NOTE.

Closes #2
Closes #5
Closes #12
Closes #15
Closes #17
Closes #19
Closes #20
Closes #21
Closes #26

…ons/progressbar

Closes stub TODOs: alerts (#2), code (#5), icons (#12), margins (#15),
notes (#17), progressbar (#19), quotes (#20), round (#21), tags (#26).

All renderers return htmltools tags compatible with {shiny}. Simple
class-returning helpers (w3_round, w3_margin) follow the existing
w3_badge/w3_color style.
- Add role='progressbar' and aria-valuenow/min/max on w3_progressbar so
  screen readers announce the value (W3.CSS docs leave this to the
  caller; opting in here makes the helper accessible by default).
- Drop the four-level match.arg() on w3_alert(level = ...). The full
  W3 palette is supported by w3_color(), and clamping the alert helper
  to red/yellow/green/blue was an arbitrary subset.
@VincentGuyader VincentGuyader self-assigned this Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment