diff --git a/README.md b/README.md index eca6fec..2273cc8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ # Roux -A boilerplate of pre-defined native CSS architecture and styling to kickstart your project. You may have used [Bitters] in the past—move on over to a fully native setup with Roux. +A boilerplate of pre-defined native CSS architecture, styling, and HTML to kickstart your project. + +## See it in action + +[View the docs site][docs site] to see Roux's base styling for forms, buttons, tables, and typography. ## What is Roux? -Roux gives you an organized foundation of CSS files, variables, and base styles so you can start building immediately instead of setting everything up from scratch. It's **a structured starting point for writing your own CSS**—not a framework like Tailwind or a UI library with pre-built components. Think of it like a GitHub template repo, but for your stylesheets. +Roux gives you an organized foundation of CSS files, variables, base styles, and simple HTML components so you can start building immediately instead of setting everything up from scratch. It's **a structured starting point for writing your own CSS**—not a framework like Tailwind. Think of it like a GitHub template repo, but for your stylesheets. + +You can cherry-pick what you need, use it for inspiration, or adopt the whole system—whatever works for your project. It's flexible and extendable, but opinionated about what matters. All HTML components are accessible and semantic by default. -You can cherry-pick what you need, use it for inspiration, or adopt the whole system—whatever works for your project. +You may have used [Bitters] and [Refills] in the past—move on over to a fully native setup with Roux. ## The problem it solves @@ -16,6 +22,7 @@ When you start a new web project, you face a blank CSS file and dozens of decisi - Should I define colors and spacing as variables, or hardcode them? - Do I need to reset browser defaults? - How do I structure forms, buttons, and typography consistently? +- Is my HTML accessible? Without a plan, you may end up with unmaintainable and disorganized CSS files that are not approachable to you or your team. Roux solves this by providing thoughtful defaults and organization patterns that scale with your project. @@ -32,7 +39,7 @@ Without a plan, you may end up with unmaintainable and disorganized CSS files th ### Don't use Roux if you: - Prefer utility-first frameworks like Tailwind -- Need pre-built UI components (use a component library instead) +- Need advanced JavaScript-heavy UI components - Already have an established CSS system you're happy with ## What you get @@ -41,10 +48,7 @@ Without a plan, you may end up with unmaintainable and disorganized CSS files th - **CSS custom properties:** Colors, spacing, font sizes defined as variables in one place - **Base element styling:** Sensible defaults for buttons, forms, tables, and more - **A system to build on:** Not a finished product, but a solid foundation you customize - -## See it in action - -[View the demo on CodePen][codepen] to see Roux's base styling for forms, buttons, tables, and typography. +- **Baseline HTML components:** A set of basic, semantic, accessible UI components ## Installation @@ -66,7 +70,8 @@ After installation: 1. **Customize your colors:** Open `css/base/_variables.css` and change the color values to match your project. 2. **Link the main CSS file:** Import or link to `css/app.css` in your HTML. 3. **Start building:** Add your component styles in `css/components/`. -4. **Compile (optional):** Use your preferred CSS compiler to bundle everything into one file +4. **Copy components:** Grab boilerplate component HTML from the [docs site] +5. **Compile (optional):** Use your preferred CSS compiler to bundle everything into one file - This project uses [lightning CSS] to minify and compile the CSS into one file. [There are lots of options for CSS compiliation](https://www.alwaystwisted.com/articles/UnSassing-my-CSS-CSS-imports), depending on your project setup and your own preferences. If you're using [Dart Sass](https://sass-lang.com/dart-sass/), you'll need to use `@use` instead of `@import` in your main `app.css` file (you'll also need to switch your file types from `css` to `scss`). - To compile in this repo, run `npm i` then `npm run build` (will output into a `dist` folder). @@ -114,7 +119,7 @@ css/ 2. `base/_variables.css` is one of the outliers of our base files as it stores all of our [custom properties]. This comes before all of the other base files since it's a dependency. You don't have to change any of these values if you don't want to. However, you'll likely want to at least adjust the colors. **[More on variables](#variables)** 3. `base/_fonts.css` is the other outlier as files like `_typography.css` may rely on it. It's commented out for now since it needs an actual font file to work and you may want to remove it if importing a font in a different way. **[More on fonts](#fonts)** 4. The rest of the base files make use of many of the custom properties and are not dependent on each other. They're currently in ABC order. **[More on base files](#base)** -5. The `components` folder is empty. This is where you'll put your component-based styles (e.g. `components/_card.css`). Ensure the import list is in ABC order for readability. +5. The `components` folder is where you'll put your component-based styles (e.g. `components/_card.css`). Ensure the import list is in ABC order for readability. 6. Utilities are last! Right now there's only one utility. Add in any other global utilities you might have that can be applied as a class. You can prepend them with `.u-[utility-name]` and give them their own CSS file. **[More on utilities](#utilities)** ## Customization guide @@ -221,17 +226,22 @@ Roux uses a classname for a "button" style since it can be applied to both `butt #### Example +[View example buttons on the docs site][docs site buttons] + ```html A secondary button link ``` + ### Forms -Most form styling relies on how you structure the HTML. In Roux's styling, you should be nesting an input within a label. [See the demo codepen][codepen] for structuring. +Most form styling relies on how you structure the HTML. In Roux's styling, you should be nesting an input within a label. #### Example +[View example forms on the docs site][docs site forms] + ```html ``` @@ -274,11 +279,6 @@ If you prefer to keep those elements separate, you can adjust the CSS in the for id="email" type="email" name="email" - autocapitalize="off" - autocorrect="off" - spellcheck="false" - required - autocomplete="email" /> ``` @@ -300,6 +300,7 @@ label + :where( } ``` + ## Other files explained ### Animation @@ -314,6 +315,8 @@ Any global animations can go here. Roux's only animation defines smooth scrollin Basic styling for the `details` and `summary` elements with a custom details marker caret. +[View example disclosures on the docs site][docs site disclosures] + ### Layout `base/css/_layout.css` @@ -340,171 +343,24 @@ Defines pictures, videos, etc. as block elements that should size responsively w Default setup and some base styles for `dialog` elements. This includes some transition declarations as well as `::backdrop` styling. -The `.slide-in` class can be added for a smooth slide-from-bottom transition when opening a modal (and a slide out on close). [See the codepen demo][codepen] for setup in HTML and Javascript. +The `.slide-in` class can be added for a smooth slide-from-bottom transition when opening a modal (and a slide out on close). [See the docs site][docs site modals] for setup in HTML and Javascript. -#### Tips - -- Use the autofocus attribute on the first interactive element you want to focus to when a modal is open (usually the close modal button). #### Example -**Default modal** +[View example modals on the docs site][docs site modals] -```html - - -

Hello there

-
-``` - -**Slide in modal** - -```html - - -

Hello there

-
-``` ### Tables `base/css/_tables.css` -Rounded border and striped row styling for tables. This also includes classes to make an overflow scroll table for data sets that are wider than the viewport. [See the codepen demo for structure][codepen]. +Rounded border and striped row styling for tables. This also includes classes to make an overflow scroll table for data sets that are wider than the viewport. #### Example -**A plain table** +[View example tables on the docs site][docs site tables] -```html - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Monthly spending -
MonthSavings
January$100
February$80
March$30
Sum$210
-``` - -**A striped table** - -```html - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Monthly spending -
MonthSavings
January$100
February$80
March$30
Sum$210
-``` - -**A striped table with overflow scroll for smaller viewports** - -```html -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Monthly spending with overflow container for smaller viewports -
CategoryPlannedActualDifference
Rent/Mortgage$1,200$1,200$0
Utilities$150$140-$10
Groceries$400$420+$20
Transportation$100$80-$20
Entertainment$200$220+$20
Miscellaneous$100$90-$10
-
-
-``` ### Typography @@ -512,18 +368,21 @@ Rounded border and striped row styling for tables. This also includes classes to A fairly unopinionated typographical setup. This isn't a type scale, but some basic defaults such as ensuring headings are bolded and using a pretty text wrap on `h1`s. This also leverages the base typographic custom properties in `body`. You can use the `--font-size--[variant]` custom properties in `_variables.css` to be more specific about type size. +[View example typography on the docs site][docs site typography] + ### Components -This folder is empty! But this is where you'd put any component-based CSS files. +This is where you'd put any component-based CSS files. It starts with some baseline components. #### Example ```text components/ -├── _card.css -├── _header.css -├── _navigation.css -└── _footer.css +├── _alert_.css +├── _badge.css +├── _loading-indicator.css +├── _page-footer.css +└── ... ``` ### Utilities @@ -569,7 +428,15 @@ We are [available for hire][hire]. +[docs site]: https://roux.thoughtbot.dev/ +[docs site typography]: https://roux.thoughtbot.dev/component-library/typography.html +[docs site buttons]: https://roux.thoughtbot.dev/component-library/button.html +[docs site forms]: https://roux.thoughtbot.dev/component-library/form.html +[docs site disclosures]: https://roux.thoughtbot.dev/component-library/disclosure.html +[docs site modals]: https://roux.thoughtbot.dev/component-library/dialog.html +[docs site tables]: https://roux.thoughtbot.dev/component-library/table.html [bitters]: https://github.com/thoughtbot/bitters +[refills]: https://github.com/thoughtbot/refills [Rails setup guide]: guides/rails-setup.md [codepen]: https://codepen.io/enatario/pen/LEppZLZ [custom properties]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascading_variables/Using_CSS_custom_properties diff --git a/package.json b/package.json index f59d5f5..bc796d7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "roux", "version": "0.2.2", - "description": "A boilerplate of pre-defined native CSS styling", + "description": "A boilerplate of pre-defined native CSS styling & HTML components", "type": "module", "homepage": "https://github.com/thoughtbot/roux", "main": "index.js", diff --git a/site/README.md b/site/README.md index 971955d..8f4f51b 100644 --- a/site/README.md +++ b/site/README.md @@ -1,4 +1,4 @@ -# Roux Component Library Site +# Roux Docs Site ## Development diff --git a/site/_includes/layouts/base.njk b/site/_includes/layouts/base.njk index 425edcd..ead2843 100644 --- a/site/_includes/layouts/base.njk +++ b/site/_includes/layouts/base.njk @@ -1,6 +1,6 @@ -{%- set siteName = 'Roux Components' -%} +{%- set siteName = 'Roux CSS' -%} {%- set siteUrl = 'https://roux.thoughtbot.dev' -%} -{%- set siteDescription = 'Extend Roux CSS with ready-to-use components to build your project.' -%} +{%- set siteDescription = 'A boilerplate of pre-defined native CSS architecture, styling, and HTML to kickstart your project.' -%} {%- set pageTitle = title ~ ' - ' ~ siteName if title else siteName -%} {%- set pageDescription = description or siteDescription -%} diff --git a/site/_includes/partials/_header.njk b/site/_includes/partials/_header.njk index 261bcb9..bcadd00 100644 --- a/site/_includes/partials/_header.njk +++ b/site/_includes/partials/_header.njk @@ -6,7 +6,7 @@ Skip to main content - +
- - -``` +Checkout the [GitHub README][github] for all the details on how to use Roux. Then come back here to grab the HTML for components. ## Components @@ -105,10 +47,23 @@ Open source templates are Copyright (c) thoughtbot, inc. It contains free softwa Everyone interacting in Roux's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/thoughtbot/roux/blob/main/CODE_OF_CONDUCT.md). + + ## About thoughtbot [![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)](https://thoughtbot.com) This repo is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc. -We love open source software! See [our other projects.](https://thoughtbot.com/community?utm_source=github) We are [available for hire.](https://thoughtbot.com/hire-us?utm_source=github) +We love open source software! +See [our other projects][community]. +We are [available for hire][hire]. + +[community]: https://thoughtbot.com/community?utm_source=github +[hire]: https://thoughtbot.com/hire-us?utm_source=github + + + +[github]: https://github.com/thoughtbot/roux +[bitters]: https://github.com/thoughtbot/bitters +[refills]: https://github.com/thoughtbot/refills \ No newline at end of file diff --git a/site/robots.txt b/site/robots.txt index 856680b..7df05d3 100644 --- a/site/robots.txt +++ b/site/robots.txt @@ -1,4 +1,4 @@ -# Robots.txt for Roux Components +# Robots.txt for Roux CSS # https://roux.thoughtbot.dev User-agent: *