Vue.js Assignment– 7
Vue UI Patterns & Component Design
Basic Questions
- Create a dumb ButtonPrimary component that only accepts label and emits click.
- Create a smart UserListContainer that fetches users and passes data to a dumb UserList.
- Convert a presentational table into a dumb component that receives rows and columns as props.
- Build a card component that exposes a scoped slot for custom header content.
- Use a scoped slot to render a list item with custom markup provided by the parent.
- Create a dynamic component switcher that toggles between LoginForm and SignupForm.
- Render a component dynamically by name from an array of component strings.
- Implement a child component that emits update:modelValue and bind with v-model.
- Add a custom event submitted to a form component and handle it in the parent.
- Create a minimal event bus with a tiny emitter and use it to broadcast app:ready.
- Add ARIA roles to a tablist component: role=”tablist”, role=”tab”, role=”tabpanel”.
- Implement keyboard navigation (Left/Right) for tabs using keydown on the tab elements.
- Add aria-expanded and aria-controls to an accordion button + panel.
- Provide aria-live=”polite” region to announce form submit results.
- Add aria-invalid and aria-describedBy to inputs when showing validation errors.
- Create a render function that outputs a simple <ul><li>…</li></ul> from props.
- Install JSX support and render a <Badge> component using JSX in Vue.
- Emit a typed payload (object) from child to parent and assert its shape in the handler.
- Implement a StopPropagationButton that stops event bubbling on click.
- Add aria-busy=”true” to a button while an async action runs and reset it on completion.
Intermediate Questions
- Refactor a page into smart container + dumb presentational components; move all data fetching to the container.
- Build a dumb DataTable that renders via a scoped slot for each cell to customize content.
- Create a ListProvider smart component that exposes { items, loading, error } via a scoped slot.
- Implement a dynamic component router that renders components from a config array with props.
- Write a render function that injects attributes and listeners into its children (this.$slots.default).
- Create a JSX-based Menu component that supports nested items and emits select.
- Add a custom event strategy: child emits save, parent re-emits save upward with extra metadata.
- Build a small event bus plugin with on, off, emit and provide/inject it app-wide.
- Implement a global beforeUnmount listener that unsubscribes components from the event bus.
- Add ARIA keyboard support to a dropdown: Down to open, Esc to close, Enter to select.
- Add focus trapping in a modal using tabindex and return focus to the opener on close.
- Provide accessible labels for icon-only buttons with aria-label and title.
- Implement aria-current=”page” for active navigation link in a custom router-link wrapper.
- Create a controlled vs uncontrolled input pair and compare v-model vs explicit value/emit.
- Build a Toggle dumb component and a ThemeToggleContainer smart component that persists state.
- Implement a renderless component that exposes pagination state via a scoped slot.
- Create a Portal component that renders its slot into a different DOM node via render function.
- Write a JSX List that accepts a renderItem prop (function as child) to render each item.
- Add role=”alertdialog” to a confirmation modal and wire up ARIA attributes correctly.
- Build a Breadcrumbs component with proper nav/aria-label and list semantics.
Advanced Questions
- Design a component library skeleton: all components dumb by default, with separate smart containers.
- Implement a renderless autocomplete that exposes { query, results, select, loading } via scoped slots.
- Build a dynamic form renderer that maps a JSON schema to dynamic components using a render function.
- Create an event channel pattern: namespaced events (cart:add, cart:remove) with the event bus.
- Implement a batched emit strategy: child queues rapid changes and emits a single change after debounce.
- Create a complex a11y-compliant combobox with ARIA roles (combobox, listbox, option) and keyboard support.
- Write a JSX VirtualList that only renders visible rows and emits scroll-end for infinite loading.
- Build a layout system component that uses scoped slots for header/sidebar/content and supports dynamic component injection.
- Create a plugin that enforces accessibility checks (warn when components miss ARIA labels on interactive elements).
- Final Hands-on Project:
- Refactor a medium UI into smart containers + dumb components
- Use scoped slots and a renderless component for reusable behaviors
- Mix render functions and JSX for highly dynamic UIs
- Establish event strategy (custom events, namespaced bus, batched emits)
- Ensure full accessibility: roles, keyboard, focus management, live regions, and ARIA attributes throughout