--- name: konsta-ui description: Guide to using Konsta UI for pixel-perfect iOS and Material Design components in Capacitor apps. Works with React, Vue, and Svelte. Use this skill when users want native-looking UI without Ionic, or prefer a lighter framework. --- # Konsta UI Design Guide Build pixel-perfect iOS and Material Design apps with Konsta UI. ## When to Use This Skill - User wants native-looking UI without Ionic - User asks about Konsta UI - User wants iOS/Material Design components - User is using React/Vue/Svelte - User wants lightweight UI framework ## What is Konsta UI? Konsta UI provides: - Pixel-perfect iOS and Material Design components - Works with React, Vue, and Svelte - Tailwind CSS integration - ~40 mobile-optimized components - Small bundle size (~30KB gzipped) ## Getting Started ### Installation ```bash # React bun add konsta # Vue bun add konsta # Svelte bun add konsta # Required: Tailwind CSS bun add -D tailwindcss postcss autoprefixer bunx tailwindcss init -p ``` ### Tailwind Configuration ```javascript // tailwind.config.js const konstaConfig = require('konsta/config'); module.exports = konstaConfig({ content: [ './src/**/*.{js,ts,jsx,tsx,vue,svelte}', ], // Extend or override Konsta config theme: { extend: {}, }, }); ``` ### Setup (React) ```tsx // App.tsx import { App, Page, Navbar, Block } from 'konsta/react'; export default function MyApp() { return ( {/* or theme="material" */}

Hello Konsta UI!

); } ``` ### Setup (Vue) ```vue ``` ## Core Components ### Page Structure ```tsx import { App, Page, Navbar, NavbarBackLink, Block, BlockTitle, } from 'konsta/react'; function MyPage() { return ( history.back()} />} /> Section Title

Block content with rounded corners and padding.

); } ``` ### Lists ```tsx import { List, ListItem, ListInput, ListButton, } from 'konsta/react'; import { ChevronRight } from 'framework7-icons/react'; function MyList() { return ( <> {/* Simple list */} {/* List with details */} } link /> {/* Form list */} Login ); } ``` ### Forms ```tsx import { List, ListInput, Toggle, Radio, Checkbox, Stepper, Range, } from 'konsta/react'; import { useState } from 'react'; function MyForm() { const [toggle, setToggle] = useState(false); const [gender, setGender] = useState('male'); return ( {/* Text inputs */} {/* Toggle */} setToggle(!toggle)} /> } /> {/* Radio */} setGender('male')} /> } /> setGender('female')} /> } /> {/* Checkbox */} } /> {/* Stepper */} } /> {/* Range */} } /> ); } ``` ### Buttons ```tsx import { Button, Segmented, SegmentedButton } from 'konsta/react'; import { useState } from 'react'; function Buttons() { const [active, setActive] = useState(0); return (
{/* Button variants */} {/* Colors */} {/* Disabled */} {/* Segmented control */} setActive(0)}> Tab 1 setActive(1)}> Tab 2 setActive(2)}> Tab 3
); } ``` ### Cards ```tsx import { Card, Button } from 'konsta/react'; function Cards() { return (

Card Title

Card description text goes here. This is a standard card with image, title, and content.

); } ``` ### Dialogs and Sheets ```tsx import { Dialog, DialogButton, Sheet, Popup, Button, Page, Navbar, Block, } from 'konsta/react'; import { useState } from 'react'; function Dialogs() { const [dialogOpen, setDialogOpen] = useState(false); const [sheetOpen, setSheetOpen] = useState(false); const [popupOpen, setPopupOpen] = useState(false); return ( <> {/* Alert dialog */} setDialogOpen(false)} title="Dialog Title" content="Dialog content goes here." buttons={ <> setDialogOpen(false)}> Cancel setDialogOpen(false)}> OK } /> {/* Bottom sheet */} setSheetOpen(false)} >

Sheet Title

Sheet content

{/* Full page popup */} setPopupOpen(false)}> setPopupOpen(false)}> Close } /> Popup content ); } ``` ### Tabbar Navigation ```tsx import { App, Page, Tabbar, TabbarLink, Icon } from 'konsta/react'; import { Home, Search, Person } from 'framework7-icons/react'; import { useState } from 'react'; function TabsApp() { const [activeTab, setActiveTab] = useState('home'); return ( {/* Page content based on active tab */} {activeTab === 'home' && } {activeTab === 'search' && } {activeTab === 'profile' && } {/* Tabbar */} setActiveTab('home')} icon={} label="Home" /> setActiveTab('search')} icon={} label="Search" /> setActiveTab('profile')} icon={} label="Profile" /> ); } ``` ## Theming ### Theme Selection ```tsx import { App } from 'konsta/react'; // Auto-detect platform // Force iOS style // Force Material style ``` ### Dark Mode ```tsx import { App } from 'konsta/react'; // Auto dark mode (follows system) // Explicit dark mode // Explicit light mode ``` ### Custom Colors with Tailwind ```javascript // tailwind.config.js const konstaConfig = require('konsta/config'); module.exports = konstaConfig({ theme: { extend: { colors: { primary: { DEFAULT: '#6366f1', dark: '#4f46e5', }, }, }, }, // Override Konsta's primary color konpistaConfig: { colors: { primary: '#6366f1', }, }, }); ``` ### Component-Level Styling ```tsx // Override individual component colors ``` ## With Capacitor ### Safe Area Handling ```tsx import { App, Page } from 'konsta/react'; function MyApp() { return ( {/* Content respects safe areas */} ); } ``` ### Capacitor Integration ```tsx import { App, Page, Button } from 'konsta/react'; import { Capacitor } from '@capacitor/core'; function MyApp() { const isNative = Capacitor.isNativePlatform(); return ( ); } ``` ## Comparison: Konsta vs Ionic | Feature | Konsta UI | Ionic | |---------|-----------|-------| | Bundle Size | ~30KB | ~200KB | | Components | ~40 | ~100+ | | Tailwind Integration | Native | Possible | | Routing | External | Built-in | | Framework Support | React, Vue, Svelte | React, Vue, Angular | | Native Features | UI only | UI + Plugins | **Choose Konsta when:** - You want Tailwind-first approach - You need smaller bundle size - You're using Svelte - You want simpler setup **Choose Ionic when:** - You need comprehensive component library - You want built-in routing - You need more complex components - You prefer all-in-one solution ## Best Practices ### Performance ```tsx // Lazy load heavy components import { lazy, Suspense } from 'react'; const HeavyComponent = lazy(() => import('./HeavyComponent')); function App() { return ( Loading...}> ); } ``` ### Accessibility ```tsx // Konsta components are accessible by default // Add labels for screen readers // For icon-only buttons ``` ## Resources - Konsta UI Documentation: https://konstaui.com/ - Konsta React Docs: https://konstaui.com/react - Konsta Vue Docs: https://konstaui.com/vue - Konsta Svelte Docs: https://konstaui.com/svelte - GitHub: https://github.com/konstaui/konsta