shadshiny 0.4.0
Prepared for a first CRAN release. Every exported help page now has an example; those that need a running app build one inside
if (interactive()). Theshad_theme_from_registry()and toast examples no longer use\dontrun{}, and theshad_current_theme()andshad_chat_server()examples are now complete apps: they called server functions outside a session, so they failed when run. The package now ships aCOPYRIGHTSfile with the licence notices for the Lucide icons (ISC; some derive from Feather, MIT) and the shadcn/ui colour token values (MIT), and DESCRIPTION points to it in aCopyright:field. The README and the package help say the same. Help pages now write the Cmd and Shift keys as text, or as R escapes in example code, because the PDF manual could not typeset their key symbols. A test keeps help pages to characters the manual can typeset.Five more full-ramp colour presets from shadcn/ui:
"zinc","mauve","olive","mist"and"taupe". Like"slate"and"stone", each one recolours every surface, border and text token, in light and dark mode, and tunes the chart grid and labels to match. Use them withpage_shad(theme_preset=),shad_theme_preset(),update_shad_theme()andshad_tokens(). Muted text is darkened in light mode, as in the other presets, so that it keeps a 4.5:1 contrast. Tests now check that the CSS andshad-tokens.jsonagree for every preset, and that the text in each full-ramp preset stays at 4.5:1 on its surfaces. The bundle’s gzip budget for the CSS rises from 22 KiB to 23 KiB, and for CSS and JavaScript together from 64 KiB to 65 KiB.Live integrations with external chat stream providers, such as streaming an
ellmerchat, are experimental, and now say so wherever they are shown: the README, the chat article, theshad_chat_server()andshad_run_example()help, and the08-llm-chatexample. A test requires it.shad_theme_echarts4r()keeps a text style already set on the chart, such as its font family and size, and changes only its colour; it used to replace the whole style. Tests now cover the chart adapters for ggplot2, plotly and echarts4r, in light and dark mode.Fixes from a visual review in light, dark, right-to-left and reduced motion.
shad_table()given a data frame renders its body rows again. Dialogs, alert dialogs and the command palette are centred on right-to-left pages, where they sat partly off-screen, and so are resizable grips and vertical slider thumbs. Breadcrumb lists drop Bootstrap’s list indent, and the checkbox tick no longer animates under reduced motion. The.shad-scopelink colour no longer overrides component link colours: breadcrumb links are muted again, and an anchor styled as a button keeps its text colour on hover. A short bubble in a message footer stays on one line, andshad_chart_container(aspect = "auto")keeps the height of the plot output inside it instead of collapsing it.shad_chat_ui()shows itswelcomeuntil the first message (it was accepted but never shown), and its composer now spans the chat’s width.The examples and the charts article pass
bg = "transparent"torenderPlot(), so plots sit on the card in dark mode. The LLM chat example’s Clear button works, and the examples’ native selects have accessible names.shad_command()’s help page documentsinput$<inputId>_event, which every command emits on each activation, not only the palette. The component-contract test now requires each such side input on its constructor’s help page, and countsupdate_shad_command()as the command’s updater.The twelve articles that show code without running it use the
knitr::rmarkdown_notangleengine.R CMD checkon R versions that run vignette code, such as R 4.3, ran their examples, which failed and in the chat article started an app that never returned. A test now requires such articles to tangle to no code.The advertised component count now follows a documented rule: a component is an asset family with an exported constructor of its own, which gives 73. Every experimental function is labelled as such in its help page, in the README’s API stability list, and in each article that uses it. A test derives these claims from the source so they cannot drift.
shad_checkbox()gainstristate = TRUE, letting clicks cycle unchecked, checked, and indeterminate. The default keeps the shadcn/ui behavior, where only the server can set the indeterminate state again.Inputs can now return to their empty state. Clearing a
shad_select()or singleshad_combobox()restores its placeholder instead of the label it was created with; picking the selected item of a single combobox, or the selected day of a single-mode calendar or date picker, clears it as in shadcn/ui; and a non-numericupdate_shad_number_input()value is ignored instead of showingNaN.update_shad_select()andupdate_shad_combobox()only select real choices. A numericselectednow matches its choice (it used to show the placeholder while reporting the number), a value that is not a choice is ignored with a browser console warning instead of being reported as the input’s value, and multiple mode drops unknown and duplicate entries.A multiple
shad_combobox()can be used from the keyboard alone. Each chip’s remove control is now a real button placed before the trigger rather than inside it, so Tab reaches it and Enter, Space, Delete or Backspace removes the value; the combobox root now draws the input box. Tab in the open search closes the list and moves on from the trigger instead of losing focus, and Shift+Tab returns to the trigger.shad_calendar()andshad_date_picker()handle dates more strictly and keep focus. An impossible date such as"2026-02-31"no longer rolls into the next month;update_shad_calendar()andupdate_shad_date_picker()ignore a date outsidemin/maxwith a browser console warning and put a reversed range in order; and a server value no longer closes the date picker or moves focus to its trigger. Arrow keys move whole days across daylight-saving changes, PageUp and PageDown stop at the end of a shorter month, and the month buttons and selects keep focus.disabled = TRUEcalendars now disable every control, and date-range presets are cut tomin/max(a preset wholly outside them is disabled).shad_command()andshad_command_palette()are easier to use from the keyboard. The search input is now the only tab stop (every item used to be one too), an open palette keeps Tab on its search instead of wrapping onto an item, and clicking an item keeps focus in the search. Items swapped in byupdate_shad_command()are proper options, and their empty text now shows when nothing matches. Thehotkeyneeds exactly the modifiers it names, so"mod+k"no longer fires on Ctrl+Shift+K,"mod+shift+p"leaves Ctrl+P (Print) alone, and"ctrl+k"no longer fires on a plain K. A hotkey without Ctrl, ⌘ or Alt, such as"/", is left to text fields, and an IME composition keeps Enter and the arrows. Focus traps (dialogs, sheets, popovers) now skip elements with a negativetabindex, as Tab does.shad_data_table_server()gainsmax_page_size = 1000and checks every request beforesourceruns. A request for a larger page, a page whose offset would overflow an R integer, a sort or filter value that is not a single string, or a column sorted twice is refused with a server warning and the table’s error state, instead of reachingsource(a crafted request could ask for the whole dataset). Withcolumns, a sort or filter on a column declaredsortable = FALSEorfilterable = FALSEis refused too, and undeclared columns in a page still show but no longer offer sorting or filtering the server would refuse.update_shad_data_table()on a server-backed table now asks the server for the newpageorpage_sizeinstead of relabelling the rows already shown. A page size the table does not offer, or severalselectedkeys for a single-selection table, is ignored with a browser console warning, andpageandpage_sizemust be positive whole numbers.shad_data_table()adds itspage_sizetopage_sizeswhen it is missing, so the select shows the size in use, and refuses apage_sizeof 0, which hung the browser. Filtering and sorting read HTML cells through an inert template, so they no longer load images or run handlers for rows that are not on the page.shad_data_table_server()now serves a table thatrenderUI()draws after the server function has run, or draws again: the table switches to server mode when its value first reaches the server, instead of the helper sending the switch at startup, which such a table never received. It also ignores a request older than the last one answered, as documented; it used to pass stale requests tosource.Removing UI with a popup or dialog open no longer leaves it behind. A command palette dialog that was open when
renderUI()replaced its output stayed on the page with its hotkey live, its scroll lock held and its input still bound, and a second one appeared when the output came back. A menu closed in the frame it opened (Escape pressed at once) keeps focus on its trigger instead of moving it into the closing menu.A label given to
shad_select(),shad_combobox(),shad_date_picker(),shad_radio_group(),shad_rating(),shad_slider()orshad_input_otp()now names the part that takes focus, and the description and error describe it; before, the label pointed at a wrapper that cannot be labelled, so screen readers announced the control without its label. The select trigger is now a combobox, which makes its open state valid ARIA; with no label, its placeholder names it.Development hardening now runs every fixture-gated browser suite in CI, enforces an 82% repository coverage floor plus 80% patch coverage, tests the declared R 4.1 minimum explicitly, and selects local
RscriptfromPATHunlessSHADSHINY_RSCRIPTis set. The behavioral fixture now demonstrates the package’s spacing primitives instead of relying on incidental flow layout.Plan 7 adds the keyboard shortcut group, escaped code-block, CSS-only scroll fade, and readable shimmer text utilities. Code copy uses a native button, exact code text, repeatable polite status announcements, and safe delegated handling; scroll fades use masks only and shimmer text respects reduced-motion and forced-colors preferences.
Experimental structured AI workbench modules
shad_chat_workbench_ui()andshad_chat_workbench_server()accept provider-owned public events for text, sources, tools, attachments, status, replacement, and completion. They keep the existing streaming chat API unchanged, escape untrusted content, retain response versions for retry, and never expose upload server paths or private reasoning.Experimental
bind_shad_task_button()observes an application-ownedshiny::ExtendedTaskand maps its initial, running, success, and error states to the existing button updater. It does not create tasks, invoke results, start workers, or add an asynchronous backend dependency.The experimental field composition family adds
shad_fieldset(),shad_field_group(), andshad_field_separator()as additive native-semantic primitives. Responsive groups use framework-free container-query CSS with logical properties for RTL; no JavaScript or new dependency is required. Existingshad_form_field()and validator contracts are unchanged.The release-boundary work adds derived contract gates for the 253 exported functions and 71 important signatures, including all server update helpers, without adding a generated inventory. The approved additive API is
shad_data_table_server().Browser coverage now exercises representative overlay, navigation, input, server-update, dynamic-UI, and runtime-theme behavior. The focused repairs include
ArrowUpopening a dropdown on its last enabled item and making the number-stepper disabled state authoritative in both the browser and server updater paths. The four maintained visual baselines remain unchanged.Development-only JavaScript gates now protect deterministic bundles, compressed CSS/JavaScript transfer budgets, and representative initialization and teardown timings. Node remains unnecessary for package installation and use.
The experimental
shad_data_table_server()adds lazy server-backed paging, validated page/sort/filter requests, stable row-key selection, stale-response rejection, fixed safe browser errors with retry, and the same R cell serialization as the client-side table. Database adapters, editing, grouping, pivoting, aggregation, downloads, and spreadsheet behavior remain out of scope.The experimental
shad_questionnaire()workflow adds serializable question definitions, native semantic fieldsets, required/multiple/text answers, explicit skips, named equality branching, bookmark restoration, module-safe server patches, and deterministic reset/error handling. The input value is{active, answers, skipped, complete}; arbitrary condition code, persistence, and application-specific submission remain out of scope.Chat failure finalization, trusted raw-icon handling, bookmarking, and component lifecycle behavior now have focused regression coverage. External registry-theme schemas, optional third-party chart integrations and live integrations with external chat stream providers remain explicitly outside the stable core boundary.
shad_calendar()andshad_date_picker()gaincaption_layoutandyear_range. The header previously stepped one month per click, so reaching a distant year meant hundreds of clicks (Shift+PageUp/Down was the only jump, and only from the keyboard).caption_layout = "dropdown"renders the month and year as selects, matching shadcn/ui’scaptionLayout;"dropdown-months"and"dropdown-years"pick one of the two.shad_calendar(month =)now works. It setdata-monthbut the browser code never read it, so the argument was silently ignored.Assets now ship as one minified stylesheet and one minified script (
inst/assets/dist), built bynpm run build:assets. A page used to carry ~145 tags and 1.3 MB of source; it now carries 2 tags and 274 kB. Setoptions(shadshiny.assets = "source")to load the per-component files when debugging. Node is still not needed to install or use the package.tools/audit-registry.Rdiffs the port against the live shadcn/ui registry. Running it corrected the README component markers: upstream now shipsnative-selectand the chat primitives, which shadshiny had listed as its own additions.
shadshiny 0.2.0
Eleven new components and several server-side systems that turn shadshiny from a component library into a full application toolkit.
Data table (
shad_data_table()): a client-side, shadcn-styled data table with multi-column sort (Shift+click), global and per-column filtering, windowed pagination, single/multiple row selection persisted across pages, column visibility, sticky header, and loading skeletons. Column specs viashad_col()with formattersshad_fmt_number(),shad_fmt_percent(),shad_fmt_date(), andshad_fmt_badge(), plus arbitrarycellrender functions.input$<id>reports{selected, sort, filter, page, pageSize}; refresh from the server withupdate_shad_data_table().Dashboard shells:
shad_value_box()(KPI card with trend delta chip, icon and sparkline slots),shad_chart_container()(card wrapper forplotOutput()/htmlwidgets with legend strip), andshad_timeline().Chart theming:
shad_theme_ggplot2()/shad_scale_color_shad()/shad_scale_fill_shad(),shad_theme_plotly(), andshad_theme_echarts4r()restyle plots to the active theme.shad_current_theme()is a reactive that re-runs plot code on dark-mode/preset switches.shad_chart_colors()returns the categorical chart ramp as hex (OKLCH converted in base R – no new dependency);shad_tokens()exposes the full resolved token set as CSS strings.Theming V2:
shad_theme()builds arbitrary custom themes from token overrides;shad_theme_from_registry()imports tweakcn / shadcn registry theme JSON;page_shad(theme=),shad_theme_scope(), andupdate_shad_theme(theme=)apply them at page, subtree, and runtime scope.Form validation:
shad_validator()with rules (shad_rule_required(),shad_rule_email(),shad_rule_min_chars(),shad_rule_range(),shad_rule_regex(), …), live validation, submit gating, and an error summary.update_shad_form_field(),shad_form_message(), andshad_form_summary()provide the underlying messaging.Flow / input components:
shad_stepper(),shad_tree()(with lazy branches viaupdate_shad_tree(children=)),shad_rating(),shad_number_input(), andshad_dropzone()(bridged to Shiny’s native file upload, soinput$<id>is the standard files data frame). Each is a bound input with anupdate_*()companion.Date-range presets:
shad_date_picker(mode = "range", presets = ...)adds a quick-range rail;shad_date_presets()supplies a default set.Streaming chat (
shad_chat_ui()/shad_chat_server()): a module whose handler may return a complete string, a chunk-yielding function, or a coro generator (e.g. an ellmer stream); replies stream into a stick-to-bottom transcript and render as Markdown.shad_icon_raw(): use any raw<svg>(e.g. a Lucide glyph) with the.shad-iconsizing class.New guides:
vignette("data-tables"),vignette("charts"), andvignette("chat"); the theming and forms guides now cover custom themes andshad_validator(). Two new examples:shad_run_example("07-data-explorer")andshad_run_example("08-llm-chat").input$<id>$sorton a data table now reports{column, direction}rather than the client’s terser{col, dir}.Bug fix (theme reporter): the
input$.shad_themereporter readdocument.bodyandShiny.setInputValueunguarded, and ran even with no Shiny on the page. Since the asset bundle loads in<head>, both were absent on the first pass, so it threw and aborted the rest ofshadshiny-shiny.js– takingshad.autoInit()with it.shad_current_theme()therefore never fired (charts could not follow runtime theme changes), components inserted byrenderUI()/insertUI()were left un-wired, and the pkgdown gallery previews (no Shiny) failed the same way. Components already on the page still worked, which masked it: the runtime self-initialises onDOMContentLoaded.Layout primitives:
shad_container(),shad_stack(),shad_grid()/shad_grid_item(), plus the page shellsshad_page_sidebar()andshad_page_navbar(). CSS-only; spacing arguments take a token step (gap = 4isvar(--shad-space-4)) or any CSS length, andshad_grid()handles responsive columns with an outwardvar()fallback chain rather than a utility-class grid system.Bug fix (layout): the layout primitives’ custom properties inherited, so a
shad_stack()nested inside a horizontal one laid itself out sideways (and picked up its parent’s gap and alignment). Each rule now resets its own variables toinitial.update_shad_sidebar(active=)selects a sidebar item from the server, so navigating from elsewhere – a command palette, a link – moves the rail too.New example:
shad_run_example("09-app-shell")–shad_page_sidebar()with the layout primitives, sparklines, a ⌘K palette that drives navigation, and dialogs built in the server.Server-created overlays:
shad_show_dialog()/shad_remove_dialog()build a dialog, alert dialog, sheet or drawer in the server and show it, the wayshiny::showModal()does. Transient by default: the overlay removes itself once it closes.Native mini-charts:
shad_sparkline()(line/area/bar/step) andshad_mini_donut()– inline SVG painted with the chart tokens, so they follow dark mode and preset switches in CSS with no re-render. Fillsshad_value_box(sparkline=).Command palette:
shad_command_palette()takes its items as data,shad_command_trigger()opens one from anywhere, andupdate_shad_command()refreshes the items from the server. Read selections frominput$<id>_event–input$<id>alone cannot tell one selection of “Settings” from two.Bug fix (command dialog):
shad_command(dialog = TRUE, hotkey = FALSE)rendered a visible inline palette – the asset infers dialog mode fromdata-hotkeyordata-dialog, and the constructor emitted neither.Bug fix (runtime): opening a command dialog destroyed it.
shad.portal()moves the root itself to<body>, and the runtime’s MutationObserver read that removal as an unmount. A move is a removal plus an insertion, so the teardown now skips nodes still connected to the document.Scroll/focus sweep: no component calls
scrollIntoView()any more – it walks every scrollable ancestor, so a component in ordinary document flow drags the whole page to itself. Highlights now scroll their own container viashad.util.keepInView(), and pointer-drivenfocus()passespreventScroll. Keyboard roving focus still scrolls, deliberately.Bug fix (command): an inline
shad_command()scrolled the page to itself on load, and again on every keystroke. Its highlight usedscrollIntoView()/scrollIntoViewIfNeeded(), which scroll every scrollable ancestor – harmless in dialog mode, but an inline palette is part of the document, so a page containing one opened wherever the palette sat (in the kitchen sink, a long way down at Tier 3 – overlays). The highlight now scrolls only the command list itself.Gallery: a new Data, dashboards & flow page renders the V2 kit live – data table, value boxes, chart container, timeline, stepper, tree, rating, number input, dropzone, and the form-messaging components.
Demo:
kitchen-sinknow covers the V2 components, including a plot that tracks the theme toolbar viashad_current_theme()and a liveshad_validator()form. Itsupdate_*()/ scroll / sidebar controls moved next to the components they drive – previously they sat in a card at the foot of the page and appeared to do nothing, because the component they changed was scrolled far out of view.Bookmarking:
shad_input_otp(value=)now seeds and restores its code.jsonlitemoves to Imports (used by the data table and theming).Bookmarking support: every stateful input now seeds its initial value from
shiny::restoreInput(), soenableBookmarking()(both"url"and"server") restores saved state on reload. Coversshad_input(),shad_textarea(),shad_checkbox(),shad_switch(),shad_slider(),shad_toggle(),shad_toggle_group(),shad_radio_group(),shad_select(),shad_native_select(),shad_combobox(),shad_calendar(),shad_date_picker(),shad_accordion(),shad_pagination(), andshad_tabs(). Not restored (they take no initial-value argument): the overlays’ open state,shad_input_otp(),shad_carousel(), andshad_sidebar()– their values are still saved, only not seeded back on restore.Docs: the Migrating from base Shiny guide is now a complete base-Shiny→shadshiny reference – sectioned tables covering inputs, buttons, layout, navigation, overlays, notifications, outputs, and typography, each row tagged drop-in / restyle / keep-base, plus the value-shape gotchas and the full
update_shad_*()map. (Previously an inputs-only table.)Bug fix (icons):
shad_icon()now carries the shadshiny asset dependency, so a standalone icon still loads its.shad-iconsizing CSS when it is the only shadshiny output on a page (previously such icons rendered size-less / invisible – e.g. the icon previews in the pkgdown Icons article). Nested in a component, the duplicate dependency is de-duplicated as before.Bug fix (component init):
shad.autoInit()no longer throws when the asset bundle loads in<head>beforedocument.bodyexists. Previously theMutationObserverattached to a null body, which aborted initialisation and left dynamically inserted components (renderUI,insertUI, dynamic tabs) un-wired. Components now initialise immediately and the observer attaches on DOM ready.Bug fix (input group): the wrapped control’s
width: 100%no longer forces leading/trailing addons onto their own rows – the control now flexes from a zero basis so icons, prefixes and buttons sit inline as intended.More icons: the built-in set grows from 32 to 78, adding common glyphs –
home,user,users,settings,bell,trash,pencil,download,upload,external-link,eye,eye-off,lock,unlock,heart,star,bookmark,filter,refresh-cw,log-in,log-out,copy,clipboard,save,sun,moon,image,link,phone,map-pin,credit-card,shopping-cart,package,bar-chart,activity,zap,message-circle,send,paperclip,thumbs-up,globe,github,circle-x,circle-plus,circle-help,arrow-up,arrow-down, andchevrons-down-up.Demo: the
kitchen-sinksidebar now switches its main pane per nav item, and its chat scroller starts at the top so the “Scroll chat” round-trip is visible.Documentation site. The pkgdown site is now a full handbook. A new Component gallery renders every component live – the real component next to the exact source that made it – across pages for display, inputs, overlays, navigation and the chat kit, plus a live Icons reference. The previews initialise client-side (dialogs, tabs and carousels work) and follow the site’s light/dark switch. New prose guides cover Installation & setup, Forms & validation, Layout & composition, and The server API.
New components (chat / AI kit):
shad_bubble()(+ group),shad_message()(+ group,shad_message_spinner()),shad_attachment()(+ group,shad_attachment_action()),shad_marker(), andshad_message_scroller()(+ item, and theshad_message_scroller_to_bottom()server helper) – a stick-to-bottom streaming transcript.New components (layout & inputs):
shad_native_select()(a styled real<select>withupdate_shad_native_select()),shad_empty()(empty-state panel),shad_item()(+ group, separator) – the flex list-row primitive,shad_button_group()(+ text, separator) – segmented button controls, andshad_input_group()(+ addon, text, button) – a field shell for icon/prefix/button affixes aroundshad_input()/shad_textarea().New icons:
file,folder,clock.Bug fix:
shad_context_menu()now wraps itstargetin the.shad-context-menu__zoneelement the JS binds to, so the right-click zone initialises instead of erroring on load.Demo: the
kitchen-sinkexample now exercises the full variant / size / state matrix for every component.Example apps: six new real-world example apps under
inst/examples, launchable withshad_run_example(), that together exercise the whole component library:01-auth-onboarding,02-analytics-dashboard,03-support-chat,04-storefront,05-settings-profile, and06-docs-reader.Bug fix:
shad_toast_update()called from a deferred (later::later) callback now requires thesessionto be passed explicitly; the bundled demos do so, fixing an “attempt to apply non-function” crash on toast loading→update outside the reactive domain.
shadshiny 0.1.0
Initial release.
- A framework-free port of the shadcn/ui design system for Shiny: 49 components across three tiers, shipped as a single bundled
htmlDependency()(no npm, no React, no build step). -
Tier 1 – display & typography: button, badge, avatar (+ group), card (+ parts), alert, separator, skeleton, spinner, aspect-ratio, label, progress, breadcrumb, table (+ parts), kbd, code, and the
shad_h1()–shad_p()typography set. -
Tier 2 – form inputs: input, textarea, checkbox, switch, radio group, toggle, toggle group, slider, select, combobox, input-OTP, calendar, date-picker, and the
shad_form_field()wrapper. All expose native Shiny input values via a genericdata-shadbinding. - Tier 3 – overlays: dialog, alert-dialog, sheet, drawer, popover, tooltip, hover-card, dropdown-menu, context-menu, menubar, command palette, and toast.
- Tier 3 – navigation & structure: tabs, accordion, collapsible, pagination, scroll-area, resizable, carousel, navigation-menu, and the sidebar layout family.
-
Server API:
update_shad_*()helpers for every valued component,shad_<overlay>_open()/_close()controllers, and ashad_toast()family (success/error/warning/loading, plusshad_toast_update()for loading→done flows). All are Shiny-module safe. -
Theming: OKLCH
--shad-*token system with seven presets (slate, stone, blue, green, rose, violet, orange),page_shad(theme_preset=), and runtimeupdate_shad_theme(). Dark mode synchronizes withbslib::input_dark_mode()out of the box. -
Demo:
shad_run_example("kitchen-sink")exercises every component, variant, and server round-trip.