floating-ui – skill Thiết kế & UI cho agent AI
Hướng dẫn triển khai Floating UI cho Web và App. Kích hoạt khi người dùng muốn thẻ tách rời, thành phần nổi và cảm giác nhẹ nhàng, thoáng đãng.
Cài skill floating-ui bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/floating-ui-32bb4.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /floating-ui – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/floating-ui-32bb4.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $floating-ui – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/floating-ui-32bb4.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /floating-ui – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/floating-ui-32bb4.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /floating-ui – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Floating UI
> "Defying gravity. Elements that hover effortlessly above the surface."
When to Use
Use this sub-style when the user's request matches the aesthetic described above. This is a child reference of the design-it skill and is not meant to be triggered directly.
Core Principles
1. Detachment: UI elements (like nav bars, sidebars, or main content cards) do not touch the edges of the screen. They float with margins on all sides.
2. Soft, Diffuse Shadows: Large, highly blurred shadows directly beneath elements.
3. Pill Shapes & Rounds: Fully rounded corners (pill shapes) enhance the floating, bubble-like aesthetic.
Visual DNA
- Colors: Earth-Grounded Elegance or Minimalist Slate. Use a slightly tinted background (off-white or very light gray) so the floating white elements pop.
- Typography: Clean, airy sans-serifs with generous line height.
- Layout: The "floating island" pattern for navigation (a pill-shaped nav bar centered at the bottom or top of the screen).
Web Implementation
- Focus on large margins and specific shadow styles.
- CSS Example:
body {
background-color: var(--bg-primary); /* e.g., #F4F4F9 */
padding: 24px; /* Ensure nothing touches the edge */
}
.floating-nav {
position: fixed;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
background: white;
border-radius: 50px; /* Pill shape */
padding: 12px 32px;
/* Large, soft shadow */
box-shadow: 0 16px 40px rgba(0,0,0,0.08);
display: flex;
gap: 24px;
}
.floating-card {
background: white;
border-radius: 24px;
padding: 32px;
margin-bottom: 24px;
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}App Implementation
SwiftUI
struct FloatingUIView: View {
var body: some View {
ZStack {
// Very light background
Color(red: 0.95, green: 0.95, blue: 0.97).ignoresSafeArea()
ScrollView {
VStack(spacing: 24) {
// Floating Content Card
VStack(alignment: .leading, spacing: 12) {
Text("Floating Card")
.font(.title2).fontWeight(.bold)
Text("This card hovers above the background, with massive soft shadows and completely rounded corners.")
.foregroundColor(.secondary)
}
.padding(32)
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.white)
.cornerRadius(32) // Very large radius
// Large, highly blurred shadow
.shadow(color: Color.black.opacity(0.05), radius: 30, x: 0, y: 15)
.padding(.horizontal, 24) // Keeps it detached from edges
}
.padding(.top, 40)
}
// Floating Pill Navigation
VStack {
Spacer()
HStack(spacing: 40) {
Image(systemName: "house.fill").foregroundColor(.blue)
Image(systemName: "magnifyingglass").foregroundColor(.gray)
Image(systemName: "bell.fill").foregroundColor(.gray)
Image(systemName: "person.fill").foregroundColor(.gray)
}
.padding(.vertical, 16)
.padding(.horizontal, 32)
.background(Color.white)
.clipShape(Capsule()) // Pill shape
.shadow(color: Color.black.opacity(0.1), radius: 25, x: 0, y: 10)
.padding(.bottom, 32) // Detached from bottom edge
}
}
}
}- A
.clipShape(Capsule())with a massive.shadow()creates the perfect floating pill navigation bar. - Push the
.shadow(radius: ...)up to 25 or 30 with a very low opacity (0.05) to get the soft, diffuse hover effect.
Flutter
class FloatingUIScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF4F4F9),
body: Stack(
children: [
ListView(
padding: const EdgeInsets.all(24),
children: [
// Floating Content Card
Container(
margin: const EdgeInsets.only(bottom: 24),
padding: const EdgeInsets.all(32),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(32), // Large radius
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 30,
offset: const Offset(0, 15),
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('Floating Card', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
SizedBox(height: 12),
Text('This card hovers above the background.', style: TextStyle(color: Colors.grey)),
],
),
),
],
),
// Floating Bottom Nav
Align(
alignment: Alignment.bottomCenter,
child: Container(
margin: const EdgeInsets.only(bottom: 32),
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(50), // Pill shape
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.1), blurRadius: 25, offset: const Offset(0, 10))
],
),
child: Row(
mainAxisSize: MainAxisSize.min, // Wrap content
children: const [
Icon(Icons.home, color: Colors.blue),
SizedBox(width: 40),
Icon(Icons.search, color: Colors.grey),
SizedBox(width: 40),
Icon(Icons.person, color: Colors.grey),
],
),
),
),
],
),
);
}
}- Prefer a semantic navigation component where possible. A custom floating menu needs actual labeled buttons, selection state, safe-area insets and reserved scroll-content space so it does not cover content.
- Use
blurRadius: 30inBoxShadowfor the diffuse look.
React Native
const FloatingUIScreen = () => {
return (
<View style={{ flex: 1, backgroundColor: '#F4F4F9' }}>
<ScrollView contentContainerStyle={{ padding: 24 }}>
{/* Floating Card */}
<View style={styles.floatingCard}>
<Text style={{ fontSize: 24, fontWeight: 'bold', marginBottom: 12 }}>Floating Card</Text>
<Text style={{ color: '#666' }}>This card hovers above the background, detached from all edges.</Text>
</View>
</ScrollView>
{/* Floating Pill Nav */}
<View style={styles.floatingNav}>
<Text style={{ fontSize: 20 }}>🏠</Text>
<Text style={{ fontSize: 20, opacity: 0.5 }}>🔍</Text>
<Text style={{ fontSize: 20, opacity: 0.5 }}>👤</Text>
</View>
</View>
);
};
const styles = StyleSheet.create({
floatingCard: {
backgroundColor: '#FFF',
borderRadius: 32,
padding: 32,
marginBottom: 24,
// iOS shadow
shadowColor: '#000',
shadowOffset: { width: 0, height: 15 },
shadowOpacity: 0.05,
shadowRadius: 30,
// Android shadow
elevation: 8,
},
floatingNav: {
position: 'absolute',
bottom: 40,
alignSelf: 'center',
flexDirection: 'row',
backgroundColor: '#FFF',
borderRadius: 50,
paddingVertical: 16,
paddingHorizontal: 32,
gap: 40, // Needs RN 0.71+
shadowColor: '#000',
shadowOffset: { width: 0, height: 10 },
shadowOpacity: 0.1,
shadowRadius: 25,
elevation: 10,
}
});position: 'absolute'withalignSelf: 'center'is the easiest way to place the pill nav in React Native.- Android's
elevationdoesn't support massive blur radii very well, so the effect is stronger and softer on iOS.
Jetpack Compose
@Composable
fun FloatingUIScreen() {
Box(modifier = Modifier.fillMaxSize().background(Color(0xFFF4F4F9))) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(24.dp)
) {
// Floating Card
Box(
modifier = Modifier
.fillMaxWidth()
.shadow(15.dp, RoundedCornerShape(32.dp), spotColor = Color.Black.copy(alpha = 0.05f))
.background(Color.White, RoundedCornerShape(32.dp))
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- free-design-resources – Sổ đăng ký tài nguyên thiết kế: tài nguyên và nhà cung cấp, loại giấy phép, quy tắc…
- free-tier-strategy – Thiết kế gói miễn phí chuyển đổi thành trả phí mà không gây phản cảm hay lạm dụng. Cụm…
- frontend-api-integration-patterns – Mẫu sẵn sàng cho production để tích hợp ứng dụng frontend với API backend, gồm xử lý…
- frontend-data-contracts – Kỷ luật độc lập framework về type safety tại ranh giới mạng của mọi ứng dụng React hoặc…
- frontend-design – Thiết kế và triển khai giao diện frontend nổi bật trong khuôn khổ thương hiệu, khả năng…
- frontend-dev-guidelines – Bạn là kỹ sư frontend cấp cao, làm việc theo tiêu chuẩn kiến trúc và hiệu năng nghiêm…
- frontend-lighthouse – Thêm cổng Lighthouse CI có thể tái sử dụng cho bản build frontend production, với ngân…
- frontend-mobile-development-component-scaffold – Khởi tạo khung component React và React Native với TypeScript, khả năng truy cập, test…