Convert Figma logo to code with AI

htmlstreamofficial logopreline

Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.

4,753
298
4,753
19

Top Related Projects

A utility-first CSS framework for rapid UI development.

170,434

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

18,293

A lightweight and modular front-end framework for developing fast and powerful web interfaces

49,259

Modern CSS framework based on Flexbox

Materialize, a CSS Framework based on Material Design

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

Quick Overview

Preline is an open-source UI library built with Tailwind CSS, offering a comprehensive set of pre-built components and interactive elements for web development. It provides a collection of customizable and responsive UI components that can be easily integrated into Tailwind CSS projects, helping developers create modern and visually appealing web interfaces quickly.

Pros

  • Extensive collection of pre-built UI components and interactive elements
  • Seamless integration with Tailwind CSS projects
  • Responsive design out of the box
  • Active development and regular updates

Cons

  • Requires Tailwind CSS knowledge for optimal usage
  • May increase bundle size due to additional JavaScript for interactive components
  • Limited customization options compared to building from scratch
  • Potential for design homogeneity across projects using the library

Code Examples

  1. Adding a button component:
<button type="button" class="py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800">
  Button
</button>
  1. Creating a modal dialog:
<button type="button" class="py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800" data-hs-overlay="#hs-basic-modal">
  Open modal
</button>

<div id="hs-basic-modal" class="hs-overlay hidden w-full h-full fixed top-0 left-0 z-[60] overflow-x-hidden overflow-y-auto">
  <div class="hs-overlay-open:opacity-100 hs-overlay-open:duration-500 opacity-0 transition-all sm:max-w-lg sm:w-full m-3 sm:mx-auto">
    <div class="flex flex-col bg-white border shadow-sm rounded-xl dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
      <div class="flex justify-between items-center py-3 px-4 border-b dark:border-gray-700">
        <h3 class="font-bold text-gray-800 dark:text-white">
          Modal title
        </h3>
        <button type="button" class="hs-dropdown-toggle inline-flex flex-shrink-0 justify-center items-center h-8 w-8 rounded-md text-gray-500 hover:text-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 focus:ring-offset-white transition-all text-sm dark:focus:ring-gray-700 dark:focus:ring-offset-gray-800" data-hs-overlay="#hs-basic-modal">
          <span class="sr-only">Close</span>
          <svg class="w-3.5 h-3.5" width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M0.258206 1.00652C0.351976 0.912791 0.479126 0.860131 0.611706 0.860131C0.744296 0.860131 0.871447 0.912791 0.965207 1.00652L3.61171 3.65302L6.25822 1.00652C6.30432 0.958771 6.35952 0.920671 6.42052 0.894471C6.48152 0.868271

Competitor Comparisons

A utility-first CSS framework for rapid UI development.

Pros of Tailwind CSS

  • Highly customizable and flexible utility-first CSS framework
  • Extensive documentation and large community support
  • Seamless integration with popular JavaScript frameworks

Cons of Tailwind CSS

  • Steeper learning curve for developers new to utility-first CSS
  • Potentially larger initial file size due to comprehensive utility classes

Code Comparison

Tailwind CSS:

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
  Button
</button>

Preline:

<button class="py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800">
  Button
</button>

Summary

Tailwind CSS offers a more flexible and customizable approach, with a larger ecosystem and community support. It's ideal for developers who prefer granular control over their styling. Preline, on the other hand, provides pre-built components that are easier to implement out of the box, making it more suitable for rapid prototyping or developers who prefer a component-based approach. The code comparison shows that Tailwind CSS uses more concise utility classes, while Preline offers more detailed, pre-styled components.

170,434

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

Pros of Bootstrap

  • Extensive documentation and large community support
  • Comprehensive set of components and utilities
  • Well-established and battle-tested in production environments

Cons of Bootstrap

  • Larger file size, potentially impacting page load times
  • More opinionated design, which may require more customization
  • Steeper learning curve for beginners due to its extensive features

Code Comparison

Bootstrap:

<div class="container">
  <div class="row">
    <div class="col-md-6">
      <button class="btn btn-primary">Click me</button>
    </div>
  </div>
</div>

Preline:

<div class="max-w-[85rem] mx-auto px-4 sm:px-6 lg:px-8">
  <div class="grid md:grid-cols-2 gap-4">
    <div>
      <button class="py-3 px-4 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600">
        Click me
      </button>
    </div>
  </div>
</div>

Bootstrap offers a more concise syntax, while Preline provides more detailed class-based styling, potentially offering greater flexibility for customization directly in HTML.

18,293

A lightweight and modular front-end framework for developing fast and powerful web interfaces

Pros of UIkit

  • More mature and established project with a larger community
  • Extensive documentation and examples
  • Wider range of components and features

Cons of UIkit

  • Larger file size and potentially slower performance
  • Steeper learning curve due to its comprehensive nature
  • Less frequent updates compared to Preline

Code Comparison

UIkit:

<div class="uk-card uk-card-default">
    <div class="uk-card-header">
        <h3 class="uk-card-title">Title</h3>
    </div>
    <div class="uk-card-body">
        <p>Content</p>
    </div>
</div>

Preline:

<div class="bg-white border rounded-xl shadow-sm">
    <div class="p-4 md:p-5">
        <h3 class="text-lg font-bold">Title</h3>
        <p class="mt-2">Content</p>
    </div>
</div>

UIkit uses its own class naming convention with the uk- prefix, while Preline utilizes Tailwind CSS classes. UIkit's approach may lead to more semantic HTML, whereas Preline's utility-first approach offers more flexibility in styling. Both frameworks provide similar functionality, but with different implementation styles and levels of customization.

49,259

Modern CSS framework based on Flexbox

Pros of Bulma

  • Larger community and ecosystem with more resources and third-party extensions
  • Simpler learning curve due to its pure CSS approach without JavaScript dependencies
  • More extensive documentation and examples for various components and layouts

Cons of Bulma

  • Lacks built-in JavaScript functionality for interactive components
  • May require more custom code for complex UI interactions and animations
  • Less frequent updates and slower adoption of modern design trends

Code Comparison

Bulma (CSS-only approach):

<div class="card">
  <div class="card-content">
    <p class="title">Card title</p>
    <p class="subtitle">Card subtitle</p>
  </div>
</div>

Preline (HTML with Tailwind classes):

<div class="flex flex-col bg-white border shadow-sm rounded-xl dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
  <div class="p-4 md:p-5">
    <h3 class="text-lg font-bold text-gray-800 dark:text-white">Card title</h3>
    <p class="mt-1 text-gray-800 dark:text-gray-400">Card subtitle</p>
  </div>
</div>

Both frameworks offer efficient ways to create UI components, but Preline leverages Tailwind CSS for more granular control over styles, while Bulma provides a simpler, more traditional CSS class approach.

Materialize, a CSS Framework based on Material Design

Pros of Materialize

  • More mature and established project with a larger community
  • Comprehensive set of UI components and features
  • Better documentation and examples

Cons of Materialize

  • Larger file size and potentially slower performance
  • Less frequent updates and maintenance
  • More opinionated design, which may require more customization

Code Comparison

Materialize:

<div class="row">
  <div class="col s12 m6">
    <div class="card blue-grey darken-1">
      <div class="card-content white-text">
        <span class="card-title">Card Title</span>
        <p>Card content</p>
      </div>
    </div>
  </div>
</div>

Preline:

<div class="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700">
  <div class="p-5">
    <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Card Title</h5>
    <p class="mb-3 font-normal text-gray-700 dark:text-gray-400">Card content</p>
  </div>
</div>

Materialize uses a grid system with predefined classes, while Preline relies more on utility classes for styling. Preline's approach offers more flexibility but may require more markup. Materialize's syntax is more concise but less customizable without modifying the source CSS.

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

Pros of Foundation

  • More mature and established project with a larger community and ecosystem
  • Offers a wider range of UI components and features out of the box
  • Provides extensive documentation and learning resources

Cons of Foundation

  • Larger file size and potentially slower performance compared to Preline
  • Steeper learning curve for beginners due to its comprehensive nature
  • Less frequent updates and slower adoption of modern web technologies

Code Comparison

Preline (Tailwind CSS-based):

<button type="button" class="py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800">
  Button
</button>

Foundation:

<button type="button" class="button">
  Button
</button>

Foundation relies on predefined classes and SASS variables for styling, while Preline uses utility classes from Tailwind CSS for more granular control over design. Foundation's approach results in cleaner HTML but less flexibility, whereas Preline offers more customization options at the cost of more verbose markup.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Hero Image

Logo

Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.

License: MIT

Why use Preline UI?

Based on the Tailwind CSS utility classes, Preline UI's prebuilt components and UI elements help you quickly design and customize responsive mobile-first websites with the components a website needs, including buttons, dropdowns, navigation bars, modals, and more.

What's in the box?

Components are grouped by visual usability criteria (components, navigation, forms, etc.) and styled directly on top of Tailwind CSS, making them easy to extend and customize. This is a lifesaver for developers looking to create a unique and eye-catching design system without the hassle of creating each component by hand.

Getting Started

Quick Setup

This guide will help you get started with Preline UI, including how to run, customize, update, and integrate your project!

First, you need to make sure that you have a working Tailwind CSS project installed and that you also have Node and NPM installed on your machine.

Require via NPM

  1. Install preline via npm
npm i preline
  1. Include Preline UI as a plugin in the tailwind.config.js file
module.exports = {
  content: [
    'node_modules/preline/dist/*.js'
  ],
  plugins: [
    require('preline/plugin')
  ],
}
  1. Include the JavaScript tag:

Documentation

For full documentation of the Preline options, visit preline.co. The site also contains information on the wide variety of plugins that are available for TailwindCSS projects.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable use GitHub Discussions

License

Preline UI is free for both personal and commercial projects, released under dual license terms MIT and Preline UI Fair Use License , and copyrighted 2024 by Preline Labs Ltd.

Preline UI Figma is free for both commercial and personal projects, learn more here.

All brand icons are trademarks of their respective owners. The use of these trademarks does not indicate endorsement of the trademark holder by Preline UI, nor vice versa.

A product of Htmlstream

Preline UI is built and maintend by Htmlstream team. Over the last decade at Htmlstream, our journey has involved crafting UI Components and Templates. This process has allowed us to understand and explore a range of strategies for developing versatile UI designs that can adapt to a variety of needs.

Share your thoughts about Preline on Twitter or leave supportive review on ProductHunt.

NPM DownloadsLast 30 Days