Challenge - 5 Problems
Headless UI Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What is the main advantage of using Headless UI components?
Headless UI components provide unstyled, accessible UI primitives. What is the biggest benefit of this approach?
Attempts:
2 left
💡 Hint
Think about how Headless UI separates logic from style.
✗ Incorrect
Headless UI components provide the logic and accessibility features but leave styling entirely to the developer, allowing full design control.
📝 Syntax
intermediate1:30remaining
Which Tailwind class correctly applies a responsive grid layout?
You want a grid with 1 column on small screens and 3 columns on medium and larger screens. Which class string achieves this?
Attempts:
2 left
💡 Hint
Remember Tailwind uses mobile-first approach and responsive prefixes like md:
✗ Incorrect
The class 'grid grid-cols-1 md:grid-cols-3 gap-4' sets 1 column by default and 3 columns on medium screens and up.
❓ rendering
advanced2:00remaining
What will be the visible result of this Headless UI Menu component snippet?
Consider this React code using Headless UI Menu and Tailwind CSS:
import { Menu } from '@headlessui/react';
export default function Example() {
return (
);
}Attempts:
2 left
💡 Hint
Headless UI Menu.Button toggles Menu.Items visibility with styling applied.
✗ Incorrect
The Menu.Button is styled blue with white text. Clicking it toggles the Menu.Items dropdown with white background and border. Each Menu.Item link changes background and text color on hover (active).
❓ selector
advanced1:30remaining
Which Tailwind selector targets only the focused state of a Headless UI button?
You want to style a Headless UI button only when it is focused (keyboard or programmatically). Which Tailwind class applies this style correctly?
Attempts:
2 left
💡 Hint
Focus styles apply when the element is focused, not hovered or active.
✗ Incorrect
The 'focus:' prefix applies styles only when the element is focused. Other prefixes like 'hover:', 'active:', and 'visited:' apply in different states.
❓ accessibility
expert2:00remaining
What ARIA role does Headless UI assign to its Dialog component by default?
Headless UI Dialog component manages accessibility automatically. Which ARIA role is assigned to the main dialog container?
Attempts:
2 left
💡 Hint
Dialogs usually have a specific ARIA role to identify them as modal windows.
✗ Incorrect
Headless UI Dialog uses role="dialog" by default to identify the container as a dialog window for assistive technologies.