shadcn-ui 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -0
  3. data/.prettierrc.json +6 -0
  4. data/README.md +260 -0
  5. data/Rakefile +6 -3
  6. data/app/assets/stylesheets/{application.scss → application.css} +0 -27
  7. data/app/assets/stylesheets/application.tailwind.css +46 -73
  8. data/app/assets/stylesheets/shadcn.css +216 -0
  9. data/app/controllers/components_controller.rb +1 -1
  10. data/app/controllers/documentation_controller.rb +10 -0
  11. data/app/helpers/application_helper.rb +19 -0
  12. data/app/helpers/components/accordion_helper.rb +14 -1
  13. data/app/helpers/components/alert_helper.rb +4 -2
  14. data/app/helpers/components/button_helper.rb +2 -1
  15. data/app/helpers/components/card_helper.rb +2 -2
  16. data/app/helpers/components/checkbox_helper.rb +2 -2
  17. data/app/helpers/components/collapsible_helper.rb +8 -0
  18. data/app/helpers/components/filter_helper.rb +12 -0
  19. data/app/helpers/components/input_helper.rb +21 -0
  20. data/app/helpers/components/label_helper.rb +5 -0
  21. data/app/helpers/components/list_helper.rb +15 -0
  22. data/app/helpers/components/progress_helper.rb +5 -0
  23. data/app/helpers/components/sheet_helper.rb +29 -0
  24. data/app/helpers/components/skeleton_helper.rb +5 -0
  25. data/app/helpers/components/slider_helper.rb +5 -0
  26. data/app/helpers/components_helper.rb +11 -0
  27. data/app/helpers/documentation_helper.rb +2 -0
  28. data/app/helpers/examples_helper.rb +1 -2
  29. data/app/javascript/controllers/theme_controller.js +25 -0
  30. data/app/javascript/controllers/ui/dialog_controller.js +3 -1
  31. data/app/javascript/controllers/ui/dropdown_controller.js +2 -22
  32. data/app/javascript/controllers/ui/filter_controller.js +20 -0
  33. data/app/javascript/controllers/ui/popover_controller.js +29 -1
  34. data/app/javascript/controllers/ui/sheet_controller.js +33 -0
  35. data/app/javascript/controllers/ui/slider_controller.js +14 -0
  36. data/app/javascript/controllers/ui/tooltip_controller.js +1 -1
  37. data/app/views/application/index.html.erb +122 -0
  38. data/app/views/components/ui/_accordion.html.erb +2 -2
  39. data/app/views/components/ui/_alert.html.erb +15 -3
  40. data/app/views/components/ui/_alert_dialog.html.erb +1 -1
  41. data/app/views/components/ui/_card.html.erb +2 -2
  42. data/app/views/components/ui/_checkbox.html.erb +3 -7
  43. data/app/views/components/ui/_collapsible.html.erb +2 -6
  44. data/app/views/components/ui/_command.html.erb +0 -0
  45. data/app/views/components/ui/_dialog.html.erb +1 -1
  46. data/app/views/components/ui/_filter.html.erb +14 -0
  47. data/app/views/components/ui/_input.html.erb +8 -0
  48. data/app/views/components/ui/_label.html.erb +3 -0
  49. data/app/views/components/ui/_list.html.erb +5 -0
  50. data/app/views/components/ui/_progress.html.erb +15 -0
  51. data/app/views/components/ui/_sheet.html.erb +44 -0
  52. data/app/views/components/ui/_skeleton.html.erb +1 -0
  53. data/app/views/components/ui/_slider.html.erb +2 -0
  54. data/app/views/components/ui/_textarea.html.erb +1 -1
  55. data/app/views/components/ui/shared/{_dialog_background.html.erb → _backdrop.html.erb} +1 -0
  56. data/app/views/components/ui/svg/_check.html.erb +11 -0
  57. data/app/views/documentation/about.html.md +20 -0
  58. data/app/views/documentation/generators.html.md +1 -0
  59. data/app/views/documentation/index.html.erb.bak +70 -0
  60. data/app/views/documentation/index.html.md +37 -0
  61. data/app/views/documentation/installation.html.md +377 -0
  62. data/app/views/examples/components/accordion/_usage.html.erb +15 -0
  63. data/app/views/examples/components/accordion/code/_block.html.erb +8 -0
  64. data/app/views/examples/components/accordion/code/_description.html.erb +7 -0
  65. data/app/views/examples/components/accordion/code/preview.erb +3 -0
  66. data/app/views/examples/components/accordion/code/usage.erb +16 -0
  67. data/app/views/examples/components/accordion.html.erb +36 -0
  68. data/app/views/examples/components/alert/_usage.html.erb +10 -0
  69. data/app/views/examples/components/alert/code/_attention.erb +3 -0
  70. data/app/views/examples/components/alert/code/_destructive.erb +2 -0
  71. data/app/views/examples/components/alert/code/_info.erb +3 -0
  72. data/app/views/examples/components/alert/code/_no_icon.erb +3 -0
  73. data/app/views/examples/components/alert/code/_success.erb +3 -0
  74. data/app/views/examples/components/alert/code/preview.erb +2 -0
  75. data/app/views/examples/components/alert/code/usage.erb +1 -0
  76. data/app/views/examples/components/alert.html.erb +90 -7
  77. data/app/views/examples/components/badge/_usage.html.erb +10 -0
  78. data/app/views/examples/components/badge/code/preview.erb +5 -0
  79. data/app/views/examples/components/badge/code/usage.erb +1 -0
  80. data/app/views/examples/components/badge.html.erb +11 -4
  81. data/app/views/examples/components/button/_usage.html.erb +19 -0
  82. data/app/views/examples/components/button/code/preview.erb +13 -0
  83. data/app/views/examples/components/button/code/usage.erb +6 -0
  84. data/app/views/examples/components/button.html.erb +20 -6
  85. data/app/views/examples/components/card/_usage.html.erb +21 -0
  86. data/app/views/examples/components/card/code/_form.erb +72 -0
  87. data/app/views/examples/components/card/code/_notifications.erb +61 -0
  88. data/app/views/examples/components/card/code/preview.erb +6 -0
  89. data/app/views/examples/components/card/code/usage.erb +3 -0
  90. data/app/views/examples/components/card.html.erb +35 -143
  91. data/app/views/examples/components/checkbox/_usage.html.erb +9 -0
  92. data/app/views/examples/components/checkbox/code/preview.erb +2 -0
  93. data/app/views/examples/components/checkbox/code/usage.erb +1 -0
  94. data/app/views/examples/components/checkbox.html.erb +14 -0
  95. data/app/views/examples/components/collapsible/_usage.html.erb +16 -0
  96. data/app/views/examples/components/collapsible/code/preview.erb +9 -0
  97. data/app/views/examples/components/collapsible/code/usage.erb +7 -0
  98. data/app/views/examples/components/collapsible.html.erb +13 -3
  99. data/app/views/examples/components/dialog.html.erb +1 -1
  100. data/app/views/examples/components/filter.html.erb +25 -0
  101. data/app/views/examples/components/input.html.erb +18 -0
  102. data/app/views/examples/components/label.html.erb +13 -0
  103. data/app/views/examples/components/progress.html.erb +12 -0
  104. data/app/views/examples/components/sheet.html.erb +19 -0
  105. data/app/views/examples/components/skeleton.html.erb +12 -0
  106. data/app/views/examples/components/slider.html.erb +12 -0
  107. data/app/views/layouts/application.html.erb +2 -3
  108. data/app/views/layouts/component.html.erb +2 -2
  109. data/app/views/layouts/documentation.html.erb +39 -0
  110. data/app/views/layouts/shared/_components.html.erb +62 -0
  111. data/app/views/layouts/shared/_header.html.erb +25 -33
  112. data/app/views/layouts/shared/_sidebar.html.erb +10 -0
  113. data/config/application.rb +2 -1
  114. data/config/importmap.rb +6 -6
  115. data/config/initializers/markdown.rb +24 -0
  116. data/config/routes.rb +7 -1
  117. data/config/shadcn.tailwind.js +98 -0
  118. data/config/tailwind.config.js +13 -74
  119. data/lib/components.json +305 -0
  120. data/lib/generators/shadcn-ui_generator.rb +201 -0
  121. data/lib/shadcn-ui/version.rb +1 -1
  122. data/package-lock.json +90 -3
  123. data/package.json +4 -0
  124. data/public/accordion.png +0 -0
  125. metadata +81 -7
  126. data/app/views/layouts/_sidebar.html.erb +0 -270
  127. data/lib/generators/shadcn_ui_generator.rb +0 -32
  128. /data/app/assets/stylesheets/{lambda.light.scss → lambda.light.css} +0 -0
@@ -2,7 +2,7 @@
2
2
  role="alert"
3
3
  class="<%= alert_classes %> relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4">
4
4
  <!--prettier-ignore-->
5
- <% case variant %>
5
+ <% case variant.to_sym %>
6
6
  <% when :default %>
7
7
  <svg
8
8
  xmlns="http://www.w3.org/2000/svg"
@@ -22,7 +22,19 @@
22
22
  y1="19"
23
23
  y2="19"></line>
24
24
  </svg>
25
- <% when :error, :alert %>
25
+ <% when :info %>
26
+ <svg class="h-4 w-4 text-info" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true">
27
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path>
28
+ </svg>
29
+ <% when :success %>
30
+ <svg class="h-4 w-4 text-success" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true">
31
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path>
32
+ </svg>
33
+ <% when :attention %>
34
+ <svg class="h-4 w-4 text-yellow-400" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true">
35
+ <path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path>
36
+ </svg>
37
+ <% when :error, :destructive, :danger, :alert %>
26
38
  <svg
27
39
  xmlns="http://www.w3.org/2000/svg"
28
40
  width="24"
@@ -49,7 +61,7 @@
49
61
  y1="16"
50
62
  y2="16"></line>
51
63
  </svg>
52
- <% end %>
64
+ <% end if icon %>
53
65
  <h5 class="mb-1 font-medium leading-none tracking-tight"><%= title %></h5>
54
66
  <div class="text-sm [&_p]:leading-relaxed"><%= description %></div>
55
67
  </div>
@@ -1,5 +1,5 @@
1
1
  <div data-controller="ui--dialog">
2
- <%= render "components/ui/shared/dialog_background", as: "backdrop" %>
2
+ <%= render "components/ui/shared/backdrop", as: "backdrop" %>
3
3
 
4
4
  <%= trigger %>
5
5
  <div
@@ -1,4 +1,4 @@
1
- <div class="rounded-lg border bg-card text-card-foreground shadow-sm w-[350px]">
1
+ <div class="rounded-lg border bg-card text-card-foreground shadow-sm w-[350px] <%= options[:class] %>">
2
2
  <% if title || subtitle %>
3
3
  <div class="flex flex-col space-y-1.5 p-6">
4
4
  <% if title %>
@@ -8,6 +8,6 @@
8
8
  <% end %>
9
9
  </div>
10
10
  <% end %>
11
- <div class="p-0 <%= "p-6 pt-0" if !block && title %> <%= "p-6" if !block && !title %> "><%= body %></div>
11
+ <div class="p-0 <%= "p-6 pt-0" if !block && title %> <%= "p-6" if !block && !title %> "><%= body %></div>
12
12
  <% if footer %><footer class="mx-6 mb-6"><%= footer %></footer><% end %>
13
13
  </div>
@@ -8,7 +8,8 @@
8
8
  value="on"
9
9
  class="peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground"
10
10
  for="<%= name %>"
11
- data-action="click->ui--checkbox#toggle">
11
+ data-action="click->ui--checkbox#toggle"
12
+ id="<%= options[:id] %>">
12
13
  <span
13
14
  class="flex items-center justify-center text-current hidden"
14
15
  style="pointer-events: none">
@@ -27,11 +28,6 @@
27
28
  </svg>
28
29
  </span>
29
30
  </button>
30
- <label
31
- for="<%= name %>"
32
- data-action="click->ui--checkbox#toggle"
33
- class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
34
- <%= label %>
35
- </label>
31
+ <%= render_label name: name, label: label, data: {action: "click->ui--checkbox#toggle"} %>
36
32
  </div>
37
33
  </div>
@@ -6,11 +6,7 @@
6
6
  class="flex items-center justify-between space-x-4 px-4"
7
7
  data-action="click->ui--collapsible#toggle">
8
8
  <h4 class="text-sm font-semibold"><%= trigger %></h4>
9
- <button
10
- class="inline-flex items-center justify-center text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-9 rounded-md w-9 p-0"
11
- type="button"
12
- aria-expanded="false"
13
- data-state="closed">
9
+ <%= render_button variant: :ghost, data: {state: "closed"}, aria: {expanded: false}, class: "px-[0.75em] " do %>
14
10
  <svg
15
11
  xmlns="http://www.w3.org/2000/svg"
16
12
  width="24"
@@ -26,7 +22,7 @@
26
22
  <path d="m7 9 5-5 5 5"></path>
27
23
  </svg>
28
24
  <span class="sr-only">Toggle</span>
29
- </button>
25
+ <% end %>
30
26
  </div>
31
27
  <%= yield :preview %>
32
28
  <div
File without changes
@@ -1,7 +1,7 @@
1
1
  <div data-controller="ui--dialog">
2
2
  <div data-action="click->ui--dialog#open"><%= content_for(:dialog_trigger) %></div>
3
3
 
4
- <%= render "components/ui/shared/dialog_background", as: "modal" %>
4
+ <%= render "components/ui/shared/backdrop", as: "modal" %>
5
5
 
6
6
  <div
7
7
  role="dialog"
@@ -0,0 +1,14 @@
1
+ <div data-controller="ui--filter">
2
+ <%= render_card do %>
3
+ <div class="flex items-center">
4
+ <%= content_for :filter_icon %>
5
+ <%= render_input name: "filter", placeholder: "Filter items...", style: :borderless, class: input_class, data: {"ui--filter-target": "source", action: "input->ui--filter#filter"} %></div>
6
+ <%= render_separator %>
7
+ <div class="<%= options[:class] %>">
8
+ <%= content_tag :div, role: "group" do
9
+ items.each do |item| %>
10
+ <div data-ui--filter-target="item"><%= list_item(value: item[:value], name: item[:name], selected: item[:selected]) %></div>
11
+ <% end
12
+ end %>
13
+ </div>
14
+ <% end %>
@@ -0,0 +1,8 @@
1
+
2
+ <%= text_field_tag name, value, type: type, id: id,
3
+ class: options[:class],
4
+ placeholder: options[:placeholder],
5
+ disabled: options[:disabled],
6
+ required: options[:required],
7
+ readonly: options[:readonly],
8
+ data: options[:data] %>
@@ -0,0 +1,3 @@
1
+ <%= label_tag name, label,
2
+ data: options[:data],
3
+ class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 #{options[:class]}" %>
@@ -0,0 +1,5 @@
1
+ <%= content_tag as, role: "group" do
2
+ items.each do |item| %>
3
+ <%= list_item(value: item[:value], name: item[:name], selected: item[:selected]) %>
4
+ <% end
5
+ end %>
@@ -0,0 +1,15 @@
1
+ <div
2
+ aria-valuemax="100"
3
+ aria-valuemin="0"
4
+ role="progressbar"
5
+ data-state="indeterminate"
6
+ data-max="100"
7
+ class="relative h-4 overflow-hidden rounded-full bg-secondary w-[60%]"
8
+ data-controller="ui--progress">
9
+
10
+ <div
11
+ data-state="indeterminate"
12
+ data-max="100"
13
+ class="h-full w-full flex-1 bg-primary "
14
+ style="transform: translateX(-50%)" data-ui--progress-target="progress"></div>
15
+ </div>
@@ -0,0 +1,44 @@
1
+ <div data-controller="ui--sheet" id="<%= options[:id] %>">
2
+ <div data-action="click->ui--sheet#open"><%= content_for(:sheet_trigger) %></div>
3
+
4
+ <%= render "components/ui/shared/backdrop", as: "modal" %>
5
+
6
+ <div
7
+ role="dialog"
8
+ data-state="closed"
9
+ data-ui--sheet-target="dialog"
10
+ class="data-[state=closed]:hidden data-[state=open]:block fixed z-50 gap-4 bg-background p-6 shadow-lg
11
+ transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500
12
+ inset-y-0 <%= direction_class(options[:direction]) %> h-full <%= options[:width] %> border-l data-[state=closed]:slide-out-to-<%= options[:direction] %> data-[state=open]:slide-in-from-<%= options[:direction] %> sm:max-w-sm" tabindex="-1"
13
+ style="pointer-events: auto">
14
+ <div data-ui--sheet-target="content"><%= content_for(:sheet_content) %></div>
15
+ <button
16
+ data-ui--sheet-target="closeButton"
17
+ type="button"
18
+ class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
19
+ <svg
20
+ xmlns="http://www.w3.org/2000/svg"
21
+ width="24"
22
+ height="24"
23
+ viewBox="0 0 24 24"
24
+ fill="none"
25
+ stroke="currentColor"
26
+ stroke-width="2"
27
+ stroke-linecap="round"
28
+ stroke-linejoin="round"
29
+ class="h-4 w-4">
30
+ <line
31
+ x1="18"
32
+ x2="6"
33
+ y1="6"
34
+ y2="18"></line>
35
+ <line
36
+ x1="6"
37
+ x2="18"
38
+ y1="6"
39
+ y2="18"></line>
40
+ </svg>
41
+ <span class="sr-only">Close</span>
42
+ </button>
43
+ </div>
44
+ </div>
@@ -0,0 +1 @@
1
+ <div class="preview flex min-h-[350px] w-full justify-center p-10 items-center"><div class="flex items-center space-x-4"><div class="animate-pulse bg-muted h-12 w-12 rounded-full"></div><div class="space-y-2"><div class="animate-pulse rounded-md bg-muted h-4 w-[250px]"></div><div class="animate-pulse rounded-md bg-muted h-4 w-[200px]"></div></div></div></div>
@@ -0,0 +1,2 @@
1
+
2
+ <input type="range" min="1" max="100" value="50" style="background-size: 50% 100%" data-controller="ui--slider" data-action="input->ui--slider#updateRange">
@@ -3,7 +3,7 @@
3
3
  placeholder="<%= options[:placeholder] %>"
4
4
  name="<%= name %>"
5
5
  id="<% id %>"
6
- <%= options[:disabled] ? "disabled" : "" %>"
6
+ <%= options[:disabled] ? "disabled" : "" %>
7
7
  <%= options[:required] ? "required" : "" %>
8
8
  <%= options[:readonly] ? "readonly" : "" %>
9
9
  <%= options[:rows] ? "rows" : "" %>></textarea>
@@ -1,5 +1,6 @@
1
1
  <div
2
2
  data-ui--dialog-target="<%= as %>"
3
+ data-ui--sheet-target="<%= as %>"
3
4
  data-state="closed"
4
5
  class="hidden fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
5
6
  style="pointer-events: auto"
@@ -0,0 +1,11 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ stroke="currentColor"
8
+ stroke-width="2"
9
+ stroke-linecap="round"
10
+ stroke-linejoin="round"
11
+ class="mr-2 h-4 w-4 opacity-0">
@@ -0,0 +1,20 @@
1
+ # About
2
+
3
+ <subtitle>Powered by amazing open source projects.</subtitle>
4
+
5
+ [ui.shadcn.com](https://ui.shadcn.com) is a project by [shadcn](https://shadcn.com).
6
+
7
+ [shadcn/ui on Rails](https://shadcn-ui-on-rails.avi.nyc) is a project by
8
+ [aviflombaum](https://avi.nyc).
9
+
10
+ ## Credits from shadcn/ui
11
+
12
+ - [Radix UI](https://radix-ui.com) - For the primitives.
13
+ - [Vercel](https://vercel.com) - Where I host all my projects.
14
+ - [Shu Ding](https://shud.in) - The typography style is adapted from his work on Nextra.
15
+ - [Cal](https://cal.com) - Where I copied the styles for the first component: the `Button`.
16
+ - [cmdk](https://cmdk.paco.me) - For the `<Command />` component.
17
+
18
+ ## License
19
+
20
+ MIT © [shadcn](https://shadcn.com)
@@ -0,0 +1 @@
1
+ # Component Generators
@@ -0,0 +1,70 @@
1
+ <main class="relative py-6 lg:gap-10 lg:py-8 xl:grid xl:grid-cols-[1fr_300px]">
2
+ <div class="mx-auto w-full min-w-0">
3
+ <div class="mb-4 flex items-center space-x-1 text-sm text-muted-foreground">
4
+ <div class="overflow-hidden text-ellipsis whitespace-nowrap">Docs</div>
5
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4"><path d="M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>
6
+ <div class="font-medium text-foreground">Introduction</div>
7
+ </div>
8
+ <div class="space-y-2">
9
+ <h1 class="scroll-m-20 text-4xl font-bold tracking-tight">Introduction</h1>
10
+ <p class="text-lg text-muted-foreground"><span data-br=":r1n:" data-brr="1" style="display: inline-block; vertical-align: top; text-decoration: inherit; max-width: 522px;">Re-usable components built using Radix UI and Tailwind CSS.</span><script>
11
+ self.__wrap_b=(e,t,r)=>{let n=(r=r||document.querySelector(`[data-br="${e}"]`)).parentElement,a=e=>r.style.maxWidth=e+"px";r.style.maxWidth="";let o=n.clientWidth,l=n.clientHeight,i=o/2-.25,s=o+.5,u;if(o){for(;i+1<s;)a(u=Math.round((i+s)/2)),n.clientHeight===l?s=u:i=u;a(s*t+o*(1-t))}r.__wrap_o||"undefined"!=typeof ResizeObserver&&(r.__wrap_o=new ResizeObserver(()=>{self.__wrap_b(0,+r.dataset.brr,r)})).observe(n)};self.__wrap_b(":r1n:",1)
12
+ </script></p>
13
+ </div>
14
+ <div class="pb-12 pt-8">
15
+ <div class="mdx">
16
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">This is <strong>NOT</strong> a component library. It's a collection of re-usable components that you can copy and paste into your apps.</p>
17
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6"><strong>What do you mean by not a component library?</strong></p>
18
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">I mean you do not install it as a dependency. It is not available or distributed via npm.</p>
19
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">Pick the components you need. Copy and paste the code into your project and customize to your needs. The code is yours.</p>
20
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6"><em>Use this as a reference to build your own component libraries.</em></p>
21
+ <h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="faq"><a class="font-medium underline underline-offset-4 subheading-anchor" aria-label="Link to section" href="#faq"><span class="icon icon-link"></span></a>FAQ</h2>
22
+ <div data-orientation="vertical">
23
+ <div data-state="closed" data-orientation="vertical" class="border-b">
24
+ <h3 data-orientation="vertical" data-state="closed" class="flex"><button type="button" aria-controls="radix-:r1p:" aria-expanded="false" data-state="closed" data-orientation="vertical" id="radix-:r1o:" class="flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&amp;[data-state=open]>svg]:rotate-180" data-radix-collection-item="">
25
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">Why copy/paste and not packaged as a dependency?</p>
26
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></button></h3>
27
+ <div data-state="closed" id="radix-:r1p:" hidden="" role="region" aria-labelledby="radix-:r1o:" data-orientation="vertical" class="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" style="--radix-accordion-content-height: var(--radix-collapsible-content-height); --radix-accordion-content-width: var(--radix-collapsible-content-width);"></div>
28
+ </div>
29
+ <div data-state="closed" data-orientation="vertical" class="border-b">
30
+ <h3 data-orientation="vertical" data-state="closed" class="flex"><button type="button" aria-controls="radix-:r1r:" aria-expanded="false" data-state="closed" data-orientation="vertical" id="radix-:r1q:" class="flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&amp;[data-state=open]>svg]:rotate-180" data-radix-collection-item="">
31
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">Do you plan to publish it as an npm package?</p>
32
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></button></h3>
33
+ <div data-state="closed" id="radix-:r1r:" hidden="" role="region" aria-labelledby="radix-:r1q:" data-orientation="vertical" class="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" style="--radix-accordion-content-height: var(--radix-collapsible-content-height); --radix-accordion-content-width: var(--radix-collapsible-content-width);"></div>
34
+ </div>
35
+ <div data-state="closed" data-orientation="vertical" class="border-b">
36
+ <h3 data-orientation="vertical" data-state="closed" class="flex"><button type="button" aria-controls="radix-:r1t:" aria-expanded="false" data-state="closed" data-orientation="vertical" id="radix-:r1s:" class="flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&amp;[data-state=open]>svg]:rotate-180" data-radix-collection-item="">
37
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">Which frameworks are supported?</p>
38
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></button></h3>
39
+ <div data-state="closed" id="radix-:r1t:" hidden="" role="region" aria-labelledby="radix-:r1s:" data-orientation="vertical" class="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" style="--radix-accordion-content-height: var(--radix-collapsible-content-height); --radix-accordion-content-width: var(--radix-collapsible-content-width);"></div>
40
+ </div>
41
+ <div data-state="closed" data-orientation="vertical" class="border-b">
42
+ <h3 data-orientation="vertical" data-state="closed" class="flex"><button type="button" aria-controls="radix-:r1v:" aria-expanded="false" data-state="closed" data-orientation="vertical" id="radix-:r1u:" class="flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&amp;[data-state=open]>svg]:rotate-180" data-radix-collection-item="">
43
+ <p class="leading-7 [&amp;:not(:first-child)]:mt-6">Can I use this in my project?</p>
44
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></button></h3>
45
+ <div data-state="closed" id="radix-:r1v:" hidden="" role="region" aria-labelledby="radix-:r1u:" data-orientation="vertical" class="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" style="--radix-accordion-content-height: var(--radix-collapsible-content-height); --radix-accordion-content-width: var(--radix-collapsible-content-width);"></div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <div class="flex flex-row items-center justify-between"><a class="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground h-9 px-4 py-2 ml-auto" href="/docs/installation">Installation<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="ml-2 h-4 w-4"><path d="M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></a></div>
51
+ </div>
52
+ <div class="hidden text-sm xl:block">
53
+ <div class="sticky top-16 -mt-10 h-[calc(100vh-3.5rem)] overflow-hidden pt-6">
54
+ <div dir="ltr" class="relative overflow-hidden pb-10" style="position: relative; --radix-scroll-area-corner-width: 0px; --radix-scroll-area-corner-height: 0px;"><style>
55
+ [data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}
56
+ </style>
57
+ <div data-radix-scroll-area-viewport="" class="h-full w-full rounded-[inherit]" style="overflow: hidden scroll;">
58
+ <div style="min-width: 100%; display: table;">
59
+ <div class="space-y-2">
60
+ <p class="font-medium">On This Page</p>
61
+ <ul class="m-0 list-none">
62
+ <li class="mt-0 pt-2"><a href="#faq" class="inline-block no-underline transition-colors hover:text-foreground text-muted-foreground">FAQ</a></li>
63
+ </ul>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </main>
@@ -0,0 +1,37 @@
1
+ # Introduction
2
+
3
+ <subtitle>Re-usable components built using Radix UI and Tailwind CSS.</subtitle>
4
+
5
+ This is **NOT** a component library. It's a collection of re-usable components that you can copy and
6
+ paste into your apps.
7
+
8
+ **What do you mean by not a component library?**
9
+
10
+ I mean you do not install it as a dependency. It is not available or distributed via npm.
11
+
12
+ Pick the components you need. Copy and paste the code into your project and customize to your needs.
13
+ The code is yours.
14
+
15
+ _Use this as a reference to build your own component libraries._
16
+
17
+ ## What?
18
+
19
+ ### The Application
20
+
21
+ The [repository for this library](https://github.com/aviflombaum/shadcn-rails) is both a gem and an
22
+ example repository containing this documentation. AFAIK there is no consequence in terms of bloat to
23
+ packaging and entire functional rails app within a gem, especially given the app has very few
24
+ dependencies, no database, and is generally very small. The benefit is that you can run the app
25
+ locally and see the components in action by booting up the application with `./bin/dev/` and going
26
+ to localhost. In fact, this website is running the application within the gem right now.
27
+
28
+ The benefit of this is that it gives you a working application from which to modify and copy the raw
29
+ files for each component. The end goal of the gem is to simply copy working code from this
30
+ application into your app so that you take ownership over the component and can customize it to your
31
+ needs without any unnecessary abstraction.
32
+
33
+ ### The Gem
34
+
35
+ The gem provides a generator for you to use in your application to facilitate copying the code from
36
+ this application to yours. It also enforces some setup for you as the component files alone in
37
+ isolation won't always work. [Learn more about the generator](/documentation/generators).