### Install Lake UI Package (Bash)
Source: https://context7.com/timtran1/lake-ui/llms.txt
This command installs the Lake UI package using npm. Ensure you have Node.js and npm (or yarn) installed in your environment before running this command.
```bash
# Install the package
npm install @deepsel/lake-ui
```
--------------------------------
### Install Lake UI Peer Dependencies
Source: https://context7.com/timtran1/lake-ui/llms.txt
Installs the necessary peer dependencies for the Lake UI React component library. This includes React, ReactDOM, and FontAwesome components.
```bash
npm install react react-dom @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons
```
--------------------------------
### Button Component Example - React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates the usage of the Button component from '@deepsel/lake-ui'. Includes examples of handling click events, setting loading states, applying custom styles and classes, and enabling hover effects. This component is built with React and TypeScript.
```tsx
import { Button } from '@deepsel/lake-ui'
import { useState } from 'react'
function LoginForm() {
const [loading, setLoading] = useState(false)
const handleSubmit = async (e: React.MouseEvent) => {
e.preventDefault()
setLoading(true)
try {
await fetch('/api/login', { method: 'POST' })
console.log('Login successful')
} catch (error) {
console.error('Login failed:', error)
} finally {
setLoading(false)
}
}
return (
)
}
```
--------------------------------
### Toast Component Example in React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Illustrates the use of the Toast component for displaying non-blocking notifications. This example shows how to trigger success, error, info, and persistent toasts with customizable positioning (corners), auto-dismissal, and styling.
```tsx
import { Toast, Button } from '@deepsel/lake-ui'
import { useState } from 'react'
function NotificationSystem() {
const [successOpen, setSuccessOpen] = useState(false)
const [errorOpen, setErrorOpen] = useState(false)
const [infoOpen, setInfoOpen] = useState(false)
const [persistentOpen, setPersistentOpen] = useState(false)
const saveData = async () => {
try {
await fetch('/api/save', { method: 'POST' })
setSuccessOpen(true)
} catch (error) {
setErrorOpen(true)
}
}
return (
Success! Your changes have been saved.
Error: Failed to save changes. Please try again.
New features are now available! Check them out.
Important Update
System maintenance scheduled for tonight at 2 AM.
)
}
```
--------------------------------
### Dialog Component Example in React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates the usage of the Dialog component for creating modal overlays. It includes examples for a user creation form and a confirmation dialog for deleting all users. The Dialog component supports click-outside-to-dismiss behavior and can be controlled via state.
```tsx
import { Dialog, Button, Input } from '@deepsel/lake-ui'
import { useState } from 'react'
function UserManagement() {
const [createOpen, setCreateOpen] = useState(false)
const [confirmOpen, setConfirmOpen] = useState(false)
const [userData, setUserData] = useState({ name: '', email: '' })
const handleCreate = async () => {
try {
const response = await fetch('/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(userData)
})
if (response.ok) {
console.log('User created successfully')
setCreateOpen(false)
setUserData({ name: '', email: '' })
}
} catch (error) {
console.error('Failed to create user:', error)
}
}
return (
)
}
```
--------------------------------
### Input Component Example - React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Illustrates the use of the Input component from '@deepsel/lake-ui'. Shows how to manage input values, handle focus effects, and integrate with form validation logic. The component is implemented using React and TypeScript, supporting standard input props.
```tsx
import { Input } from '@deepsel/lake-ui'
import { useState } from 'react'
function UserProfile() {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [errors, setErrors] = useState>({})
const handleEmailChange = (e: React.ChangeEvent) => {
setEmail(e.target.value)
if (errors.email) {
setErrors({ ...errors, email: '' })
}
}
const validateForm = () => {
const newErrors: Record = {}
if (!email.includes('@')) newErrors.email = 'Invalid email'
if (password.length < 8) newErrors.password = 'Password too short'
setErrors(newErrors)
return Object.keys(newErrors).length === 0
}
return (
)
}
```
--------------------------------
### Dropdown and DropdownItem Component Usage in React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Illustrates the use of Dropdown and DropdownItem components for creating interactive menus in React applications. It includes examples of custom toggle rendering, menu positioning, and action handling. Dependencies include @deepsel/lake-ui.
```tsx
import { Dropdown, DropdownItem, Button } from '@deepsel/lake-ui'
import { useState } from 'react'
function UserMenu() {
const [user, setUser] = useState({ name: 'Jane Smith', role: 'Admin' })
const handleMenuAction = (action: string) => {
console.log(`Menu action: ${action}`)
switch (action) {
case 'logout':
setUser(null)
window.location.href = '/login'
break
case 'profile':
window.location.href = '/profile'
break
}
}
return (
)
}
```
--------------------------------
### Checkbox Component Example - React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates the configuration and usage of the Checkbox component from '@deepsel/lake-ui'. Shows how to manage checked states, attach change handlers, provide labels, and render custom icons using FontAwesome. This component is built with React and TypeScript.
```tsx
import { Checkbox } from '@deepsel/lake-ui'
import { useState } from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faHeart } from '@fortawesome/free-solid-svg-icons'
function SettingsPanel() {
const [settings, setSettings] = useState({
notifications: false,
newsletter: true,
favorites: false
})
const handleChange = (key: string) => (e: React.ChangeEvent) => {
setSettings({ ...settings, [key]: e.target.checked })
console.log(`${key} set to:`, e.target.checked)
}
return (
}
label="Add to favorites"
style={{ marginTop: '1rem' }}
/>
)
}
```
--------------------------------
### SideDrawer Component Usage in React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Illustrates the implementation of the SideDrawer component for slide-in navigation. It supports left and right placement, a semi-transparent overlay, and click-outside-to-close functionality. The example shows how to manage the open/closed state using React's useState hook and integrate with the TopBar.
```tsx
import { SideDrawer, Button, TopBar } from '@deepsel/lake-ui'
import { useState } from 'react'
function AppWithSidebar() {
const [leftOpen, setLeftOpen] = useState(false)
const [rightOpen, setRightOpen] = useState(false)
return (
Quick Settings
Theme, notifications, and more...
Application content here
)
}
```
--------------------------------
### Use Lake UI Components in a React Application
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates how to import and utilize various components from the Lake UI library within a React application. It showcases state management for dialogs and toasts, tab navigation, and basic form elements.
```tsx
import {
Button,
Input,
Dialog,
Tabs,
TabPanel,
Card,
Toast,
TranslateAnimation
} from '@deepsel/lake-ui'
import { useState } from 'react'
function App() {
const [dialogOpen, setDialogOpen] = useState(false)
const [toastOpen, setToastOpen] = useState(false)
const [tabIndex, setTabIndex] = useState(0)
return (
Welcome to Lake UI
Content for Tab 1
Content for Tab 2
Content for Tab 3
This is a toast notification!
)
}
export default App
```
--------------------------------
### Tabs and TabPanel Component Usage in React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates how to use the Tabs and TabPanel components for creating a tabbed interface in a React application. It manages tab state and renders content within respective panels. Dependencies include @deepsel/lake-ui.
```tsx
import { Tabs, TabPanel, Card } from '@deepsel/lake-ui'
import { useState } from 'react'
function UserDashboard() {
const [tabIndex, setTabIndex] = useState(0)
const [profileData, setProfileData] = useState({
overview: { posts: 42, followers: 1234 },
activity: [{ action: 'Posted', time: '2h ago' }],
settings: { theme: 'dark', notifications: true }
})
return (
)
}
```
--------------------------------
### Switch Component: Toggle UI Elements with Customization
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates the usage of the Switch component for creating toggleable UI elements. It shows how to customize ON/OFF text, icons, and control the size of the switch. This component is useful for user preferences and settings.
```tsx
import { Switch } from '@deepsel/lake-ui'
import { useState } from 'react'
function AppSettings() {
const [darkMode, setDarkMode] = useState(false)
const [autoSave, setAutoSave] = useState(true)
const [soundEnabled, setSoundEnabled] = useState(true)
const handleDarkModeChange = (e: React.ChangeEvent) => {
const isChecked = e.target.checked
setDarkMode(isChecked)
document.body.classList.toggle('dark-mode', isChecked)
localStorage.setItem('darkMode', isChecked.toString())
}
return (
)
}
```
--------------------------------
### TopBar Component Usage in React
Source: https://context7.com/timtran1/lake-ui/llms.txt
Demonstrates how to use the TopBar component for semantic navigation headers. It includes a logo, navigation links, and user section with a logout button. This component is part of the @deepsel/lake-ui library.
```tsx
import { TopBar, Button } from '@deepsel/lake-ui'
import { useState } from 'react'
function AppLayout() {
const [user, setUser] = useState({ name: 'John Doe', avatar: '/avatar.jpg' })
return (
{user.name}
{/* Page content */}
)
}
```
--------------------------------
### useIsInViewport Hook for Lazy Loading (TypeScript/React)
Source: https://context7.com/timtran1/lake-ui/llms.txt
The useIsInViewport hook leverages the Intersection Observer API to detect when an element becomes visible in the viewport. This is crucial for implementing lazy loading strategies, improving initial page load performance by only loading content when it's needed.
```tsx
import { useIsInViewport } from '@deepsel/lake-ui'
import { useRef, useEffect, useState } from 'react'
function LazyLoadedSection() {
const sectionRef = useRef(null)
const isVisible = useIsInViewport(sectionRef)
const [data, setData] = useState(null)
const [hasLoaded, setHasLoaded] = useState(false)
useEffect(() => {
if (isVisible && !hasLoaded) {
fetch('/api/data')
.then(res => res.json())
.then(data => {
setData(data)
setHasLoaded(true)
console.log('Data loaded when section became visible')
})
}
}, [isVisible, hasLoaded])
return (
)
}
```
--------------------------------
### Card Component: Group Content with Optional Hover Effects
Source: https://context7.com/timtran1/lake-ui/llms.txt
Showcases the Card component, a versatile container for organizing related content. It supports hover effects for visual feedback (elevation and shadow) and is suitable for dashboard elements, information summaries, or general content grouping.
```tsx
import { Card, Button } from '@deepsel/lake-ui'
function DashboardCards() {
const metrics = [
{ title: 'Total Users', value: 1234, change: '+12%' },
{ title: 'Revenue', value: '$45.2K', change: '+8%' },
{ title: 'Active Sessions', value: 892, change: '-3%' }
]
return (
{metrics.map((metric, index) => (
{metric.title}
{metric.value}
{metric.change}
))}
Quick Actions
)
}
```
--------------------------------
### FadeAnimation Component for Entry Effects (TypeScript/React)
Source: https://context7.com/timtran1/lake-ui/llms.txt
The FadeAnimation component applies a fade-in effect to its children. It allows customization of opacity, duration, and delay. This component is useful for animating elements as they appear on the screen, enhancing user experience by providing smooth transitions.
```tsx
import { FadeAnimation, Card } from '@deepsel/lake-ui'
function ContentSection() {
return (
Our Services
{[1, 2, 3, 4].map((item, index) => (
Service {item}
Description of service {item}
))}
)
}
```
--------------------------------
### Slider Component: Image and Content Carousel with Controls
Source: https://context7.com/timtran1/lake-ui/llms.txt
Illustrates the use of the Slider component for creating image and content carousels. It highlights features like automatic playback, navigation controls (customizable buttons), and pausing on hover. This is ideal for product galleries or promotional banners.
```tsx
import { Slider } from '@deepsel/lake-ui'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons'
function ProductGallery() {
const products = [
{ id: 1, image: '/images/product1.jpg', title: 'Product 1' },
{ id: 2, image: '/images/product2.jpg', title: 'Product 2' },
{ id: 3, image: '/images/product3.jpg', title: 'Product 3' },
{ id: 4, image: '/images/product4.jpg', title: 'Product 4' }
]
return (
)
}
```
--------------------------------
### TextSlide Component: Animate Text on Viewport Entry (React)
Source: https://context7.com/timtran1/lake-ui/llms.txt
The TextSlide component from @deepsel/lake-ui animates text into view when it enters the viewport. It supports configurable delay, duration, and direction (top, bottom, left, right). Styles can be applied directly or via className.
```tsx
import { TextSlide } from '@deepsel/lake-ui'
function LandingPage() {
return (
Welcome to Our Platform
Build amazing applications with our component library
Get started today
Scroll to see more animations
)
}
```
--------------------------------
### TypingAnimation Component: Typewriter Effect (React)
Source: https://context7.com/timtran1/lake-ui/llms.txt
The TypingAnimation component from @deepsel/lake-ui creates a typewriter effect for text. It allows customization of cursor and text colors, typing speed (stepDuration), and repeat behavior. It is triggered on viewport entry and can be styled using the style prop or className.
```tsx
import { TypingAnimation } from '@deepsel/lake-ui'
function IntroSection() {
return (
Welcome to the future of web development...
npm install @deepsel/lake-ui
Building beautiful UIs has never been easier.
)
}
```
--------------------------------
### TranslateAnimation Component: Directional Slide with Fade (React)
Source: https://context7.com/timtran1/lake-ui/llms.txt
The TranslateAnimation component from @deepsel/lake-ui provides a directional slide-in animation with an optional fade effect. It is configurable with direction (to: 'right', 'top', 'bottom', 'left'), duration, distance, delay, and repeat mode. It can be used to animate various elements, including custom components like Card.
```tsx
import { TranslateAnimation, Card } from '@deepsel/lake-ui'
function FeaturesSection() {
const features = [
{ title: 'Fast', description: 'Lightning-fast performance' },
{ title: 'Modern', description: 'Built with latest technologies' },
{ title: 'Flexible', description: 'Customize to your needs' }
]
return (
{features.map((feature, index) => (
{feature.title}
{feature.description}
))}
Scroll down to see more content animate into view
Ready to get started?
)
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.