Challenge - 5 Problems
Tailwind Plugin Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
How does Tailwind CSS plugin system extend functionality?
Which statement best describes how Tailwind CSS plugins add new utilities or components?
Attempts:
2 left
💡 Hint
Think about how Tailwind generates CSS from JavaScript configuration.
✗ Incorrect
Tailwind plugins are JavaScript functions that add new CSS utilities or components by injecting CSS rules during the build step. They do not modify HTML or replace core styles.
📝 Syntax
intermediate2:00remaining
Identify the correct plugin registration syntax
Which option shows the correct way to register a simple Tailwind CSS plugin that adds a '.btn' class?
Tailwind
const plugin = require('tailwindcss/plugin'); module.exports = { plugins: [ /* Your plugin here */ ] }
Attempts:
2 left
💡 Hint
Look for the function signature and how addComponents is called.
✗ Incorrect
The plugin function takes a callback with an object parameter. The addComponents method is called with an object defining the new CSS classes.
❓ rendering
advanced2:00remaining
What CSS output does this plugin generate?
Given this Tailwind plugin code, what CSS will be generated for the '.card' class?
Tailwind
const plugin = require('tailwindcss/plugin'); module.exports = { plugins: [ plugin(function({ addComponents }) { addComponents({ '.card': { padding: '2rem', borderRadius: '0.5rem', boxShadow: '0 4px 6px rgba(0,0,0,0.1)' } }) }) ] }
Attempts:
2 left
💡 Hint
Check the exact property values in the plugin code.
✗ Incorrect
The plugin adds a '.card' class with padding 2rem, border-radius 0.5rem, and the specified box-shadow exactly as coded.
❓ selector
advanced2:00remaining
Which selector does this plugin add?
A Tailwind plugin adds this component:
addComponents({ '.alert-warning': { backgroundColor: '#fef3c7', color: '#92400e' } })
Which CSS selector will be available in your project?
Attempts:
2 left
💡 Hint
Look at how the class name is written in the plugin code.
✗ Incorrect
The plugin adds a CSS class selector '.alert-warning' exactly as specified, with a dot prefix and hyphen in the name.
❓ accessibility
expert3:00remaining
How to ensure accessibility in a Tailwind plugin component?
You create a Tailwind plugin that adds a modal component with a '.modal' class. Which practice best improves accessibility for keyboard users?
Attempts:
2 left
💡 Hint
Think about how keyboard users interact with modals and focus.
✗ Incorrect
Accessible modals must trap keyboard focus inside and show visible focus styles (like focus-visible) so keyboard users can navigate easily.