Generating code for the Pricing Card component

This guide provides instructions on using Figma to shadcn/ui plugin to generate code for pricing card component we created in the components chapter.

For this lesson you need to have the Pricing Card component created in Figma that we covered in this lesson.

Instructions

  1. Ensure you have a default and primary card variant ready. Note that the plugin requires selecting a component instance or frame, not the main component frame.
  2. If you have a main component, use Alt (Option on Mac) to drag instances out of the main component frame.
  3. Select the first card and rename it to "Pricing Card Default." Rename the second card to "Pricing Card Primary."
  4. Open the plugin and select the first card, "Pricing Card Default." Add this card and press "Generate Code."
  5. Copy the CLI command generated by the plugin.
  6. Open your code editor, paste the CLI command into the terminal, and run it.
  7. Check if the component renders correctly by importing the pricing card. Delete the word "default" from the export function if it's not needed.
  8. Run the project to ensure the card is generated and responsive by default.
  9. Repeat the steps for the primary card. Run the server to verify the new card renders properly.
  10. Confirm that both cards are ready, responsive, and can be used in your website sections.
Up next
Website Project (Lesson 5)
Time to take everything you learned in this chapter into practice. Let’s bring the website we designed in Figma to life!