
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
svelte-formique
Advanced tools
Formique is a robust and elegant Web Content Accessibility Guidelines (WCAG) and Web Accessibility Initiative - Accessible Rich Internet Applications (WAI-ARIA)-compliant form-building library tailored for JavaScript enthusiasts.
Formique is a robust and elegant Web Content Accessibility Guidelines (WCAG) and Web Accessibility Initiative - Accessible Rich Internet Applications (WAI-ARIA)-compliant form-building library tailored for JavaScript enthusiasts. It supports a wide array of input types, features JS-driven themes, and offers advanced functionalities like nested conditional logic and dynamic dropdowns. Highly customizable and extensible, Formique is built for the Semantq JS Framework but seamlessly integrates with Vanilla JS, React, Vue, Angular, and Svelte. This guide covers implementing Formique in Svelte.
Create a new Svelte project using the following commands:
# create a new project in the current directory
npx sv create
# create a new project in my-app
npx sv create my-app
Note: Always refer to the latest official Svelte guide on how to create a Svelte app, as this may change. Svelte Documentation: Creating a Project
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
For demo purposes, let's create a new route (page) in src/routes/registration.
Create the Route:
mkdir src/routes/registration
Create the Svelte Page:
touch src/routes/registration/+page.svelte
Paste the following Formique CSS in the <head> section of src/app.html:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/formique-css@1.0.7/formique.min.css" formique-style>
svelte-formiqueTo use Formique in your Svelte application, you need to install the svelte-formique package.
npm i svelte-formique
+page.svelteAdd the following code to +page.svelte:
<script>
import { onMount } from 'svelte';
import Formique from 'svelte-formique';
// Define the form schema
const formSchema = [
['text', 'name', 'Name', { required: true }],
['text', 'surname', 'Surname', { required: true }],
['email', 'email', 'Email', { required: true }],
['singleSelect', 'title', 'Title', { required: true }, { dependents: ['status'] },
[
{ value: 'mr', label: 'Mr' },
{ value: 'ms', label: 'Ms' },
{ value: 'mrs', label: 'Mrs' },
{ value: 'dr', label: 'Dr' },
{ value: 'prof', label: 'Prof' }
]
],
['singleSelect', 'status', 'Status', { required: true }, { dependsOn: 'title', condition: 'prof' },
[
{ value: 'full professor', label: 'Full Professor' },
{ value: 'associate professor', label: 'Associate Professor' }
]
],
['submit', 'submit', 'Submit', {}, { style: 'width: 100%;' }],
];
// Define form parameters
const formParams = {
id: "regForm",
method: "POST",
};
// Define form settings
const formSettings = {
submitOnPage: true,
theme: "midnight-blush",
requiredFieldIndicator: true,
placeholders: true,
};
// Initialize the form on component mount
onMount(() => {
const form = new Formique(formSchema, formParams, formSettings);
});
</script>
<!-- Target element where the form will be inserted -->
<div id="formique"></div>
To see the form in your browser, run the following command:
npm run dev
Once the server is running, you can view the form at:
http://localhost:5173/registration
Note If you want to use a custom target element (form container) ID, you can do so by adding the item (property)
containerId: 'element-id'in theformSettingsobject. This is particularly useful when you need to implement multiple Formique forms on a single page. Also, note that if the target element's ID is 'formique', you do not need to declare this item (property) in theformSettingsobject.
For more comprehensive details on Formique's features and usage and options visit the Formique GitHub Repository.
FAQs
Formique is a robust and elegant Web Content Accessibility Guidelines (WCAG) and Web Accessibility Initiative - Accessible Rich Internet Applications (WAI-ARIA)-compliant form-building library tailored for JavaScript enthusiasts.
We found that svelte-formique demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.