Foundation for Sites

6.9.0 · active · verified Sun Apr 19

Foundation for Sites is a comprehensive, responsive front-end framework designed for building websites and applications that adapt seamlessly to any device. It provides a robust, customizable grid system, a rich library of Sass mixins for styling, and a collection of pre-built JavaScript plugins for common UI patterns such as accordions, off-canvas menus, and responsive navigation. The current stable version is 6.9.0. Releases appear to follow a somewhat regular cadence, with several updates per year focusing on cleanup, dependency upgrades, and minor enhancements. Key differentiators include its Sass-first approach, strong accessibility support, and the ability to rapidly prototype and move to production, targeting modern web development environments with an emphasis on flexibility and customization.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and initialize Foundation Sites JavaScript components using a bundler and TypeScript, including a basic component interaction.

import $ from 'jquery';
import { Foundation } from 'foundation-sites';
import { Accordion } from 'foundation-sites';

// Ensure jQuery is globally available for Foundation's plugins
(window as any).$ = $;
(window as any).jQuery = $;

$(document).ready(() => {
  // Initialize all Foundation components on the page
  $(document).foundation();

  console.log('Foundation for Sites initialized!');

  // Example of interacting with a specific component instance
  // Assuming there's an HTML structure like: <ul class="accordion" data-accordion>...
  const accordionElement = $('.accordion').first();
  if (accordionElement.length > 0) {
    const accordionInstance = new Accordion(accordionElement);
    console.log('Accordion instance created:', accordionInstance);
    // Example: Toggle the first item
    // accordionInstance.toggle(accordionElement.children('.accordion-item').first());
  }
});

// To include Foundation's styles, typically you'd have a main SCSS file like src/style.scss:
// @import 'settings'; // Your custom Foundation settings (optional)
// @import '~foundation-sites/scss/foundation'; // Import Foundation's core Sass
// @include foundation-everything(); // Include all Foundation components via mixins (or selectively)

view raw JSON →