A laptop, a phone and a hand writing in a notebook on a wooden desk, banner image on the Component Generator page

Tools / Build suite

Component Generator

Pick a component - button, card, alert, badge or navbar - set the label and tone, and copy production-ready HTML+CSS.

Pick the component, set its label, tone and size, and get the HTML and CSS together - with a live preview - so a button or card never costs you twenty minutes of CSS archaeology.

Open the tool
Screenshot of the Component Generator tool

What it does

The snippet, with the styling attached.

Five primitives

Button, card, alert, badge and navbar cover most page scaffolding.

Tone and size

Accent color and sm/md/lg sizing apply to both preview and code.

One scoped class

Styles live behind a generated class prefix, so the snippet cannot leak into your page.

Preview is the code

The preview renders the exact markup and CSS you copy.

Contrast checked for you

The text colour is not a guess: the tool measures the contrast ratio of black and of white against your accent and picks whichever reads better.

An accent that stays readable

If your accent is too dark against the surface, the tool lightens it in small steps - up to 20 - until it clears a 7:1 contrast ratio, and adds a border when the ratio sits under 3:1.

Three sizes, real numbers

Small, medium and large set padding and type together: 12px, 14px or 17px type with padding pairs to match, so a large button actually feels large.

An alert that announces itself

The alert markup carries role="alert", so screen readers speak it when it appears, with a 3px accent edge marking it out from body text.

A navbar with working parts

Brand on the left, three links on the right, an accent hover on each link, and spacing that follows the size you picked.

No class collisions

Every rule is scoped under the genx- prefix, so the snippet drops into an existing stylesheet without renaming anything or leaking into your other components.

Copy and go

One button copies the HTML and the style block together. There is nothing to install, nothing to sign into and nothing to configure.

How it works

Pick, tune, copy.

Step 1

Choose the component type.

Step 2

Set the label, tone and size.

Step 3

Copy the HTML+CSS into your project.

FAQ

Framework version?

The output is framework-free HTML+CSS; wrap it in your component of choice.

Dark and light?

The palette is dark-first; the CSS variables at the top make it one edit to flip.

Which components are included?

Button, card, alert, badge and navbar. Each one takes your label, your accent colour and one of the three sizes.

What does the size control change?

Padding and font size together. Small is 12px type, medium is 14px and large is 17px, with padding scaled to keep the proportions.

Why did my accent colour shift?

The tool measured its contrast against the dark surface and lightened it until the ratio reached 7:1. The shifted value is what lands in the copied CSS.

Can I paste the code as-is?

Yes. The HTML goes where the component belongs and the style block goes into your stylesheet. The genx- classes are self-contained.

Does the preview match the code?

Exactly. The preview is rendered from the same CSS the copy button hands you, so what you see is what ships.

Open Component Generator

Worked example

Real output, from the tool itself.

This is what Component Generator returned for the example input shown, captured from the tool itself - not a mockup.

You enter

Component type

button

Label

Start hiring free

Size

md

The tool returns

<button class="genx-btn">Start hiring free</button>

<style>
.genx-btn{background:#bdbdbd;color:#0b0b0b;border:none;border-radius:999px;padding:11px 22px;font:600 14px system-ui,sans-serif;cursor:pointer}.genx-btn:hover{filter:brightness(1.08)}
</style>
Try it with your own input

More in the Build suite

Font Pairing LabWebhook TesterPricing Page BuilderLanding Page MakerStatus Page Starter
A laptop, headphones, a camera, a phone and a plant on a white desk, seen from above, banner image on the Component Generator page

Try it now.

Component Generator runs in your browser. No account needed.

Input To Output

Pick it, label it, copy it

Type, label,accent color,sizeLive previewHTML and CSScodeCopy codeComponentGeneratorInOut
InType, label, accent color, sizeComponentGeneratorLive previewHTML and CSS codeCopy codeOut
A few choices produce HTML and CSS you can paste.

Spec Sheet

Five component types

buttonpill with hover brighteningcardtag, title, body, linkalertleft accent bar, role alertbadgeoutline pillnavbarbrand plus three links
buttonpill with hover brighteningcardtag, title, body, linkalertleft accent bar, role alertbadgeoutline pillnavbarbrand plus three links
What each one gives you.

Before After

Padding by size

SizePaddingSmallMediumLarge7px 14px11px 22px15px 30px
Size to PaddingSmall7px 14pxMedium11px 22pxLarge15px 30px
Each size sets a padding.

Before After

Text size by size

SizeFont sizeSmallMediumLarge12px14px17px
Size to Font sizeSmall12pxMedium14pxLarge17px
Each size sets a font size.

Pipeline

How the code is made

Read type, label,color, sizePick padding andfont sizeWork out textcolorsWrite the HTMLWrite the CSS
Read type, label, color, sizePick padding and font sizeWork out text colorsWrite the HTMLWrite the CSS
The same steps run for every type.

Pipeline

Choosing button text color

Measure near blackon the accentMeasure white onthe accentPick the higherratioUse it as the textcolor
Measure near black on the accentMeasure white on the accentPick the higher ratioUse it as the text color
The button picks the more readable of two text colors.

Before After

Text on different accents

AccentText colorA light gray accentA deep blue accentNear black textWhite text
Accent to Text colorA light gray accentNear black textA deep blue accentWhite text
Light accents get dark text and dark accents get light text.

Spec Sheet

Button border fallback

Measureaccent against near blackUnder 3:1a 1px light border is addedOtherwiseno border
Measureaccent against near blackUnder 3:1a 1px light border is addedOtherwiseno border
Low-contrast accents get an edge.

Pipeline

Making accent text readable

Start with youraccentCheck contrast onthe cardbackgroundBelow 7:1: mix ina little whiteRepeat up to 20timesUse the first onethat passes
Start with your accentCheck contrast on the cardbackgroundBelow 7:1: mix in a little whiteRepeat up to 20 timesUse the first one that passes
On dark surfaces the accent is lightened until it reads clearly.

Spec Sheet

Contrast target

Target7:1 on the dark backgroundReached bylightening in 5% stepsGives up after20 steps
Target7:1 on the dark backgroundReached bylightening in 5% stepsGives up after20 steps
For accent-colored text.

Spec Sheet

Class names

Prefixgenx-Examplesgenx-btn, genx-cardScopeone class per component part
Prefixgenx-Examplesgenx-btn, genx-cardScopeone class per component part
Predictable and collision-free.

Before After

What the accent colors

TypeAccent used forButtonCardAlertBadgeNavbarBackgroundTag and link textLeft stripeOutline and textLink hover
Type to Accent used forButtonBackgroundCardTag and link textAlertLeft stripeBadgeOutline and textNavbarLink hover
Each type uses the accent in a different place.

Input To Output

Preview and code

Your choicesLive previewon the rightHTML plus astyle blockComponentGeneratorInOut
InYour choicesComponentGeneratorLive preview on the rightHTML plus a style blockOut
Both come from the same build.

Spec Sheet

The code box

Containsthe markup, then a styleblockSelf-containedno external filesCopyone click
Containsthe markup, then a style blockSelf-containedno external filesCopyone click
Ready to paste.

Pipeline

Using the code

Pick and labelCheck the previewClick Copy codePaste into yourpageRename the classesif you like
Pick and labelCheck the previewClick Copy codePaste into your pageRename the classes if you like
Paste and go.

Pipeline

Live as you change

Type, label, coloror sizeMarkup and CSSregenerateThe previewre-rendersCopy grabs thelatest
Type, label, color or sizeMarkup and CSS regenerateThe preview re-rendersCopy grabs the latest
No generate button.

Spec Sheet

The starter values

TypebuttonLabelDeploy to productionColor#bdbdbdSizesmall
TypebuttonLabelDeploy to productionColor#bdbdbdSizesmall
What you see on open.

Pipeline

Everything runs locally

No libraries orframeworksNo network callsanywhereCopy is the onlyexport
No libraries or frameworksNo network calls anywhereCopy is the only export
Nothing leaves the page.