Pages

  • Beranda

Muslim Online

  • Home
  • Menu1
    • Submenu1
    • Submenu2
    • Submenu3
  • Menu2
    • Submenu1
    • Submenu2
    • Submenu3
  • Menu3
  • Menu4
Home » Uncategories » Building Studio in Public: Using WordPress Components and Tailwind CSS in our Local Development App 

Building Studio in Public: Using WordPress Components and Tailwind CSS in our Local Development App 

— Rabu, 31 Juli 2024 — Add Comment

At WordPress.com, our goal is to provide the best tools for WordPress developers and agencies.  We built Studio for that reason. Our free local WordPress development environment launched a few months ago; it's based on Electron and is currentl…
Read on blog or Reader
Site logo image WordPress.com News Read on blog or Reader

Building Studio in Public: Using WordPress Components and Tailwind CSS in our Local Development App 

By Antonio Sejas on July 31, 2024

At WordPress.com, our goal is to provide the best tools for WordPress developers and agencies. 

We built Studio for that reason. Our free local WordPress development environment launched a few months ago; it's based on Electron and is currently available for Mac and Windows. Plus, we have big exciting updates coming for Studio users soon.

Download Studio for free

One of the unique things about Studio is that it's an open source tool, and it has been since day one. This directly aligns with the Automattic Creed, the driving force behind what we do at WordPress.com (and all of our other Automattic brands):

I know that Open Source is one of the most powerful ideas of our generation.

For this reason, we love building in public. In our new Building Studio in Public series, we want to share some of the learnings and insights we gained from building Studio, and our hope is that some of the lessons can help you build better products.

If you want more in-depth articles about why we chose Electron, why this is an open source project, or any other question you have about Studio, leave a comment below, and we'll make it happen.

First up in this series, we'll explore how we decided to use Tailwind CSS to style the WordPress components that make up Studio and why that decision gave us extra flexibility for the future of Studio.

WordPress components everywhere

Components allow developers to create reusable pieces of code that can be composed together to build complex user interfaces. They encourage a modular and declarative approach of building UIs, where each component is responsible for a single piece of functionality or user interface element.

WordPress components are a great example of that. These components allow core and extender developers to create organized, separate, and interconnected parts of the WordPress admin interface. Not only do components make development easier and more streamlined, but they are also predictable and familiar across all WordPress users.

Do not confuse WordPress components with Gutenberg Blocks. While the latter are used to build WordPress frontend websites, the former are designed for building the admin interface of the WordPress site editor. They are React-based, making them versatile and applicable in any WordPress plugin or theme admin interface. They also come in handy for building different apps beyond WordPress; the only requirement is that the project uses React.

WordPress components offer a consistent style and behavior that match the WordPress admin interface out of the box, so using them in other projects outside of the WordPress ecosystem gives a familiar look and feel to the interface and user experience. 

Not only that, the components are accessible and receive constant updates and improvements. They are implemented in JavaScript as React components, which means they can be integrated into any project. Plus, by using WordPress components in Studio, developers can more easily contribute back to this open source project because Studio is using a technology they're already used to. 

To quickly find the right component and experiment with them, you can use the WordPress Storybook, an open source tool for developing system designs and creating components in isolation. Storybook even gives you sneak peeks and allows you to interact with new components like DataViews, a component intended for future use in managing lists of posts, pages, and media uploads.

a screenshot of the DataViews component in WordPress Storybook

Components in Studio

By integrating WordPress components into Studio, we ensure a familiar user experience for WordPress users––you're building WordPress with a tool that looks and feels like WordPress. 

Most buttons, dropdowns, and menus will be familiar to WordPress users, and because Studio is an open source tool, anyone with Gutenberg experience will find it much easier to understand Studio's code and contribute if they are interested.

If you're developing a different application, you might want to adapt the WordPress component styles to fit your design. In the case of Studio, we've utilized Tailwind CSS for this purpose.

Tailwind CSS is a popular, utility-first CSS framework that we use to customize the styles of WordPress components using only CSS classes. 

Utilizing the power of WordPress components and Tailwind CSS future-proofs the Studio app; it's easy to reuse these components for new features and app updates because they're already imported into the project in a style that suits the app.

If a screen needs a new button, we already have loads of Studio-styled buttons to choose from; we don't need to design from scratch each time a new button is needed.

Here's how we used WordPress components and Tailwind CSS to build Studio (and how you can use them for your own projects, too):

Step 1: Set up Tailwind CSS and install WordPress components

After setting up Tailwind in your project, you'll need to install WordPress components. Simply run the following command:

 npm install @wordpress/components –save 

Step 2: Import WordPress component styles

You'll need to import WordPress component styles to inject the CSS that is built into the components by default. This speeds up the process of building your project's interface.

In your main CSS file, import the Gutenberg component styles:

 @import '@wordpress/components/build-style/style.css'; 

Step 3: Customize Components with Tailwind CSS

Use the className property to apply Tailwind CSS styles. Sometimes, the ! modifier is needed to mark the style as important and override existing WordPress styles.

Take Studio's Header component, for example:

a screenshot of Studio by WordPress.com with an orange box around the header component in the site view

We're using:

  • @wordpress/react-i18n for translations.
  • @wordpress/icons to display the icons.
  • The default from @wordpress/components with our own additional styling to ensure that all of Studio's buttons are consistent with one another.

To use Tailwind CSS in WordPress components, you need to pass in the utility classes to style the elements into the className React prop. Sometimes you'll need to force an overwrite to the existing WordPress styles, and that's where you can use the exclamation mark (!).

Step 4: Accessing nested elements for use across your project

With Tailwind CSS, you can use sophisticated selectors to target user interactions and nested elements within a component. This will allow you to dynamically change stylings across your project based on user and app behavior.

For example, in Studio's Demo Sites area, we change the style of the nested element's site name and badge to a grey color when the demo site expires.

a screenshot of Studio by WordPress.com with an orange box around the SnapshotRow component area

To dynamically style this component, we use [&_.badge]:text-red, where & means current element and _ means any child element. You can apply specific styles to a direct child element by using the greater-than operator, like this: [&>div]:text-red.

code showing dynamically styling WordPress components with orange arrows pointing to style child elements and disabled states

Ready to build?

By leveraging WordPress components and customizing them with Tailwind CSS, you can significantly enhance your development process, providing a seamless and professional user experience. 

This decision allowed us to create an app that looks and feels like the WordPress interface in a way that benefits users and speeds up our development time. That's a win-win, in my book. 

If you're building WordPress sites, start developing your WordPress sites locally with the power of Studio today. It's free, it's open source, and it will effortlessly fit into your development workflow. 

Download Studio for free

Once you download Studio: Be sure to connect Studio to your WordPress.com account (free or paid) to access features like Demo Sites.

And if you want to help us build Studio, here are some GitHub issues that you can contribute to right away:

  • php_curl missing and curl_exec deactivated
  • Total and free size of filesystem reported in sites doesn't match actual values 
  • Permission issues using a theme that uses composer
Comment
Like
You can also reply to this email to leave a comment.

WordPress.com News © 2024.
Manage your email settings or unsubscribe.

WordPress.com and Jetpack Logos

Get the Jetpack app

Subscribe, bookmark, and get real‑time notifications - all from one app!

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com Logo and Wordmark title=

Automattic, Inc.
60 29th St. #343, San Francisco, CA 94110

Tweet

0 Response to "Building Studio in Public: Using WordPress Components and Tailwind CSS in our Local Development App "

← Posting Lebih Baru Posting Lama → Beranda
Langganan: Posting Komentar (Atom)

Arsip Blog

  • Agustus 2025 (23)
  • Juli 2025 (61)
  • Juni 2025 (74)
  • Mei 2025 (63)
  • April 2025 (77)
  • Maret 2025 (146)
  • Februari 2025 (132)
  • Januari 2025 (134)
  • Desember 2024 (177)
  • November 2024 (166)
  • Oktober 2024 (127)
  • September 2024 (141)
  • Agustus 2024 (127)
  • Juli 2024 (167)
  • Juni 2024 (132)
  • Mei 2024 (108)
  • April 2024 (102)
  • Maret 2024 (105)
  • Februari 2024 (85)
  • Januari 2024 (64)
  • Desember 2023 (74)
  • November 2023 (91)
  • Oktober 2023 (49)
  • September 2023 (47)
  • Agustus 2023 (63)
  • Juli 2023 (45)
  • Juni 2023 (47)
  • Mei 2023 (49)
  • April 2023 (42)
  • Maret 2023 (53)
  • Februari 2023 (38)
  • Januari 2023 (39)
  • Desember 2022 (47)
  • November 2022 (15)
  • Oktober 2022 (9)
  • September 2022 (10)
  • Agustus 2022 (9)
  • Juli 2022 (9)
  • Juni 2022 (8)
  • Mei 2022 (10)
  • April 2022 (13)
  • Maret 2022 (13)
  • Februari 2022 (16)
  • Januari 2022 (15)
  • Desember 2021 (18)
  • November 2021 (16)
  • Oktober 2021 (12)
  • September 2021 (10)
  • Agustus 2021 (12)
  • Juli 2021 (18)
  • Juni 2021 (11)
  • Mei 2021 (11)
  • April 2021 (13)
  • Maret 2021 (12)
  • Februari 2021 (12)
  • Januari 2021 (13)
  • Desember 2020 (10)
  • November 2020 (14)
  • Oktober 2020 (17)
  • September 2020 (10)
  • Agustus 2020 (14)
  • Juli 2020 (17)
  • Juni 2020 (21)
  • Mei 2020 (18)
  • April 2020 (11)
  • Maret 2020 (16)
  • Februari 2020 (8)
  • Januari 2020 (9)
  • Desember 2019 (13)
  • November 2019 (12)
  • Oktober 2019 (9)
  • September 2019 (11)
  • Agustus 2019 (26)
  • Juli 2019 (32)
  • Juni 2019 (32)
  • Mei 2019 (30)
  • April 2019 (33)
  • Maret 2019 (20)
  • Februari 2019 (12)
  • Januari 2019 (16)
  • Desember 2018 (14)
  • November 2018 (25)
  • Oktober 2018 (12)
  • September 2018 (14)
  • Agustus 2018 (14)
  • Juli 2018 (12)
  • Juni 2018 (27)
  • Mei 2018 (48)
  • April 2018 (33)
  • Maret 2018 (45)
  • Februari 2018 (73)
  • Januari 2018 (337)
  • Desember 2017 (338)
  • November 2017 (251)
  • Oktober 2017 (381)
  • September 2017 (31)

Label

  • Berita
  • Kajian Islam
  • Politik
Diberdayakan oleh Blogger.
  • How to Start a Successful Blog: A 12-Step Guide for Beginners
    So, you want to start a blog, huh? First of all, that's a pretty dope idea. ...
  • Hot Off the Press: New WordPress.com Themes for January 2025
    New Year, new themes! We've been hard at work developing new themes to help ...
  • Hey - junk removal inquiry
    Hey,   I hope you're having a good Wednesday morning.  I wanted to reach out as we help junk removal companies predictably acquire new c...
↑
Copyright © 2017 - Muslim Online - All rights reserved Powered by Blogger