Documentation Shento Hendriks
Svelte / SvelteKit
Svelte / SvelteKit
  • Getting Started with SvelteKit
    • Installing SvelteKit
      • Tailwind Typography plugin
    • Base Syntax & Core Features of Svelte
      • Curly Braces & Understanding Core Syntax
      • Reactive Variables
      • Two-way-binding Shortcut
      • Using multiple components
      • Components & Communication via Props
      • Display HTML in Svelte
      • Dynamic classes
      • Using $effect
      • Working with Javascript and Rune reactivity
    • Working with Conditionals & Loops
      • Showing code conditionally in Svelte
      • Looping through arrays (lists)
      • Lists & Keys
    • Closer look at reactivity
      • Updating Arrays & Objects
      • Event Modifiers
    • Component Events
    • Best Practices
    • Adding Google Font in Tailwind and SvelteKit
    • Adding Local Fonts to SvelteKit with Tailwind
    • Prevent flicker in images
    • Enhanced Images
    • Form Submissions in SvelteKit
    • Effective SEO in SvelteKit
    • Automatic Site Maps in Svelte
    • Creating Custom Elements with Svelte, SvelteKit, and Vite
    • Creating a Svelte Library with JavaScript Functions
  • Useful Code Snippets
    • Hover effects
    • Navigation
    • Centering Items
    • Setting Footer Bottom Page
  • Installing Useful Libraries
    • Documenting Javascript with JSDocs (Crash Course)
    • Adding Lottie Animations to Svelte Application
    • SvelteKit Melt-ui
      • First Component - accordion
    • Installing Shadcn/ui Svelte
    • Getting Started with GSAP with SvelteKit
      • What is GSAP?
      • Installing GSAP & Your first animation
      • GSAP in SvelteKit
    • Installing Locomotive Scroll with Svelte 5 and SvelteKit
  • SvelteKit Server Fetching and Deployment
    • Preparing a SvelteKit application for Deployment
    • Utility Functions for URL Handling in SvelteKit
    • Fetching Directus Data from Rest API with SvelteKit
    • Fetching data from api with caching
    • Displaying Fetched Data in a Each Loop
    • Creating slug friendly urls based on query data
    • Finding correct query in api based on url slug
Powered by GitBook
On this page
  • Why Tailwind Typography is Super Useful
  • How to Use Tailwind Typography
  1. Getting Started with SvelteKit
  2. Installing SvelteKit

Tailwind Typography plugin

Tailwind Typography is a powerful plugin for the Tailwind CSS framework that helps developers create beautifully styled content with minimal effort. Here's a short guide on why it's super useful and how to use it:

Why Tailwind Typography is Super Useful

  1. Consistent Styling: Tailwind Typography provides a set of pre-defined styles that ensure consistency across your content, making it look polished and professional.

  2. Time-saving: It eliminates the need to write custom CSS for common text elements, allowing you to focus on your content rather than styling.

  3. Responsive Design: The plugin automatically adjusts typography for different screen sizes, ensuring readability across devices.

  4. Customizable: While it provides excellent defaults, you can easily customize the styles to match your project's design requirements.

  5. Improved Readability: The plugin applies carefully crafted styles that enhance the legibility of your content, making it easier for users to read and understand.

How to Use Tailwind Typography

  1. Installation: First, install the plugin using npm or yarn or bun (my favorite):

npm install @tailwindcss/typography
  1. Configuration: Add the plugin to your tailwind.config.js file:

module.exports = {
  theme: {
    // ...
  },
  plugins: [
    require('@tailwindcss/typography'),
    // ...
  ],
}
  1. Usage: Apply the prose class to your content container:

<article class="prose">
  <h1>Heading 1</h1>
  <p>This is a paragraph with some <strong>bold</strong> and <em>italic</em> text.</p>
  <ul>
    <li>List item 1</li>
    <li>List item 2</li>
  </ul>
</article>

Heading 1

This is a paragraph with some bold and italic text.

  • List item 1

  • List item 2

  1. Customization: You can customize the typography styles by modifying the theme.typography section in your tailwind.config.js file:

module.exports = {
  theme: {
    extend: {
      typography: {
        DEFAULT: {
          css: {
            color: '#333',
            a: {
              color: '#3182ce',
              '&:hover': {
                color: '#2c5282',
              },
            },
          },
        },
      },
    },
  },
  plugins: [
    require('@tailwindcss/typography'),
  ],
}

Tailwind Typography also provides size modifiers like prose-sm, prose-lg, and prose-xl for adjusting the overall size of your typography.

By following these steps, you can quickly implement and customize Tailwind Typography in your project, saving time and ensuring a consistent, readable design across your content.

PreviousInstalling SvelteKitNextBase Syntax & Core Features of Svelte

Last updated 9 months ago