Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ashcroft08/provesa-web/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheSugerenciasForm component provides an interactive form for visitors to submit suggestions, service requests, complaints, or compliments. Features a custom-styled dropdown selector, form validation, and success confirmation with auto-reset.
Location
Props
Array of suggestion types available in the dropdown menu
Features
- Custom Dropdown: Styled dropdown menu (not native
<select>) - Progressive Enhancement: Uses SvelteKit’s
use:enhancefor smooth form submission - Auto-reset: Form clears automatically 3 seconds after successful submission
- Success Animation: Displays checkmark confirmation when submission succeeds
- Character Counter: Shows message length out of 500 characters
- Optional Name Field: Anonymous submissions allowed
- Form Validation: Submit button disabled when message is empty
- Responsive Design: Fully responsive with mobile-first approach
Form Fields
Type of message selected from dropdown (hidden input)Default options:
- Sugerencia de Servicio
- Nuevo Producto Requerido
- Reclamo
- Felicitación
User’s name (optional, defaults to “Anónimo”)
The suggestion/feedback message (required, max 500 characters)
Usage Example
Basic Usage (Default Types)
+page.svelte
With Custom Types
+page.svelte
With Database Types
From/src/routes/+page.server.js:19:
+page.server.js
+page.svelte
Form Actions
The component expects a form action at?/enviarSugerencia in the parent route:
+page.server.js
States
The form has two main states:1. Input State (Default)
Shows the form with:- Custom dropdown for message type
- Optional name input
- Required message textarea
- Character counter
- Submit button (disabled if message empty)
2. Success State
After successful submission:- Green checkmark icon
- Success message: “¡Mensaje Enviado!”
- Thank you text
- Auto-resets to input state after 3 seconds
Custom Dropdown Behavior
The dropdown component:- Displays current selection
- Shows chevron icon (rotates 180° when open)
- Opens overlay with all options
- Highlights selected option with dot indicator
- Closes on option select or outside click
Progressive Enhancement
Uses SvelteKit’suse:enhance for seamless form submission:
- No full page reload
- Optimistic UI updates
- Graceful fallback without JavaScript
- Custom success handling
Visual Structure
Input State
Success State
Styling Details
- Section Background: White with decorative gradient blobs
- Form Card: Soft gray background (
bg-soft-gray) with border - Inputs: White background with slate-200 borders
- Focus State: Primary color border with ring effect
- Submit Button: Primary color with shadow and hover scale
- Success Card: Green tinted background with green border
Form Validation
-
Submit button disabled when:
- Message field is empty
- Message contains only whitespace
- Character limit: 500 characters (displayed below textarea)
Accessibility
- Semantic HTML form structure
- Label associations with
forandidattributes - Icon labels for visual context
- Disabled button has
cursor-not-allowed - Focus states with ring effects
Dependencies
$app/forms- SvelteKit’senhancefunctionlucide-svelte- Icons (MessageSquareText, Send, User, ChevronDown)
Related
- Sugerencias Service - Backend service for storing submissions
- Public Website Features - Homepage integration
- Content Management - Managing suggestion types
