v0.1 public beta early access on GitHub
Home / Screens / chat-create-group
Screen template

Create Group Screen

Name a group and pick members

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add chat-create-group
import { CreateGroupScreen } from "@/screens/chat/create-group";
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
chat/create-group.tsxsource · yours to edit
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Avatar, Button, Glass, Icon, Input, List, SearchInput, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, SEPARATOR_INSET, StickyBottomBar } from "../shared";

export interface GroupContact {
  id: string;
  name: string;
  detail: string;
  avatarUrl?: string;
}

export interface CreateGroupScreenProps {
  contacts?: GroupContact[];
  onCreate?: (name: string, memberIds: string[]) => void;
  onBack?: () => void;
}

const face = (n: number) => `https://i.pravatar.cc/150?img=${n}`;

const DEFAULT_CONTACTS: GroupContact[] = [
  { id: "m1", name: "Elena Ruiz", detail: "Product design", avatarUrl: face(24) },
  { id: "m2", name: "Milo Park", detail: "iOS engineering", avatarUrl: face(15) },
  { id: "m3", name: "Sofia Kim", detail: "Brand systems", avatarUrl: face(45) },
  { id: "m4", name: "Jonah Wells", detail: "Ops", avatarUrl: face(53) },
  { id: "m5", name: "Priya Nair", detail: "Content", avatarUrl: face(41) },
  { id: "m6", name: "Camila Ortiz", detail: "Photography", avatarUrl: face(28) },
];

/** Create group — name the group, pick members, create. */
export function CreateGroupScreen({
  contacts = DEFAULT_CONTACTS,
  onCreate,
  onBack,
}: CreateGroupScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [name, setName] = React.useState("Design crit");
  const [picked, setPicked] = React.useState<Set<string>>(new Set(["m1", "m3"]));
  const [query, setQuery] = React.useState("");

  const q = query.trim().toLowerCase();
  const shown = q
    ? contacts.filter(
        (c) => c.name.toLowerCase().includes(q) || c.detail.toLowerCase().includes(q)
      )
    : contacts;
  const pickedList = contacts.filter((c) => picked.has(c.id));

  const toggle = (id: string) => {
    haptics.selection();
    setPicked((p) => {
      const next = new Set(p);
      if (next.has(id)) next.delete(id);
      else next.add(id);
      return next;
    });
  };

  const ready = picked.size > 0 && name.trim().length > 0;

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <Mount className="gap-3 px-4 pb-3" style={{ paddingTop: insets.top + 64 }}>
        <View className="flex-row items-center gap-3">
          {/* Group photo — WhatsApp's camera tile next to the name field. */}
          <View className="h-12 w-12 items-center justify-center overflow-hidden rounded-full bg-[#BEF04C]">
            <Glass interactive effect="clear" sheen={0.5} className="absolute inset-0 rounded-full" pointerEvents="none" />
            <Icon name="camera" size="sm" color="#1B1B26" />
          </View>
          <View className="flex-1">
            <Input
              value={name}
              onChangeText={setName}
              placeholder="Group name"
              accessibilityLabel="Group name"
              glass
            />
          </View>
        </View>
        {/* Picked-member rail — WhatsApp idiom: avatars + remove X give
            instant feedback beyond a bare count. */}
        {pickedList.length > 0 && (
          <ScrollView
            horizontal
            showsHorizontalScrollIndicator={false}
            keyboardShouldPersistTaps="handled"
            contentContainerStyle={{ gap: 12 }}
          >
            {pickedList.map((c) => (
              <View key={c.id} className="w-12 items-center gap-1">
                <View>
                  <Avatar
                    size="md"
                    source={c.avatarUrl ? { uri: c.avatarUrl } : undefined}
                    fallback={c.name}
                    alt={c.name}
                  />
                  <Press
                    onPress={() => toggle(c.id)}
                    accessibilityRole="button"
                    accessibilityLabel={`Remove ${c.name}`}
                    className="absolute -right-1 -top-1 h-4.5 w-4.5 items-center justify-center rounded-full bg-foreground"
                    hitSlop={6}
                  >
                    <Icon name="x" size="sm" color="background" />
                  </Press>
                </View>
                <Text className="w-12 text-center text-[10px] text-muted-foreground" numberOfLines={1}>
                  {c.name.split(" ")[0]}
                </Text>
              </View>
            ))}
          </ScrollView>
        )}
        <SearchInput
          value={query}
          onChangeText={setQuery}
          placeholder="Search contacts"
          accessibilityLabel="Search contacts"
          glass
        />
      </Mount>

      {/* Selected-count header — like iOS picker rows, the count is the feedback. */}
      <Mount delay={60} className="flex-row items-center justify-between px-4 pb-1">
        <Text variant="small" className="text-muted-foreground">
          {picked.size === 0 ? "Select members" : "Members"}
        </Text>
        <View className="rounded-full bg-[#BEF04C] px-2.5 py-1">
          <Text className="text-xs font-bold text-[#1B1B26]">
            {picked.size} selected
          </Text>
        </View>
      </Mount>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{ paddingBottom: insets.bottom + 96 }}
      >
        <Mount delay={100}>
        <List inset glass>
          <List.Section>
            {shown.map((c, ii) => {
              const on = picked.has(c.id);
              return (
                <React.Fragment key={c.id}>
                  {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                  <List.Item
                    title={c.name}
                    subtitle={c.detail}
                    leading={
                      <Avatar
                        size="md"
                        source={c.avatarUrl ? { uri: c.avatarUrl } : undefined}
                        fallback={c.name}
                        alt={c.name}
                      />
                    }
                    trailing={
                      <View
                        className={`h-6 w-6 items-center justify-center rounded-full border ${
                          on
                            ? "border-[#BEF04C] bg-[#BEF04C]"
                            : "border-[#C9C9D4] bg-transparent"
                        }`}
                      >
                        {on && (
                          <Icon name="check" size="sm" color="#1B1B26" />
                        )}
                      </View>
                    }
                    haptic="selection"
                    onPress={() => toggle(c.id)}
                    accessibilityState={{ selected: on }}
                    className="py-2.5"
                  />
                </React.Fragment>
              );
            })}
          </List.Section>
        </List>
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <Button
          haptic="light"
          disabled={!ready}
          onPress={() => {
            haptics.medium();
            onCreate?.(name.trim(), Array.from(picked));
          }}
          accessibilityLabel={`Create group with ${picked.size} members`}
          className="w-full bg-[#BEF04C]"
          textClassName="text-[#1B1B26]"
        >
          {picked.size > 0 ? `Create group · ${picked.size}` : "Create group"}
        </Button>
      </StickyBottomBar>

      {/* Floating chrome — back pill + hug-label title pill. */}
      <View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
        <View className="flex-row items-center gap-2">
          <Glass
            effect="regular"
            className="h-11 w-11 items-center justify-center rounded-full"
          >
            <Button
              variant="ghost"
              size="icon"
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityLabel="Go back"
              className="h-9 w-9"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Button>
          </Glass>
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <Glass
            effect="regular"
            className="h-11 flex-row items-center justify-center rounded-full px-5"
          >
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              New group
            </Text>
          </Glass>
        </View>
      </View>
    </SafeAreaView>
  );
}
CreateGroupScreen.displayName = "CreateGroupScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Create Group Screen" screen in React Native using LumioUI.

Goal: Name a group and pick members Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.

## Setup

Fastest path — install the screen plus its component deps:

```bash
npx lumioui add chat-create-group
```

Or pull just the components: `npx lumioui add avatar button icon input list search-input text`

Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*

Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.

## Components — how, where, when

### `avatar` — Circular user image with fallback initials and status dot.
- `<Avatar>` ×2

### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×2

### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×4

### `input` — Labeled field with focus ring, error shake and success check.
- `<Input>` ×1

### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×1

### `search-input` — Search field with clear button, debounce, focus halo — plus a glass capsule mode that floats over content like iOS 26
- `<SearchInput>` ×1

### `text` — Themed type scale from caption to display.
- `<Text>` ×4

## Conventions (non-negotiable)

- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.

## Deliverable

One file: `screens/chat/create-group.tsx` exporting CreateGroupScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.

## Reference implementation

The LumioUI source for this screen — reproduce it faithfully:

```tsx
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Avatar, Button, Glass, Icon, Input, List, SearchInput, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, SEPARATOR_INSET, StickyBottomBar } from "../shared";

export interface GroupContact {
  id: string;
  name: string;
  detail: string;
  avatarUrl?: string;
}

export interface CreateGroupScreenProps {
  contacts?: GroupContact[];
  onCreate?: (name: string, memberIds: string[]) => void;
  onBack?: () => void;
}

const face = (n: number) => `https://i.pravatar.cc/150?img=${n}`;

const DEFAULT_CONTACTS: GroupContact[] = [
  { id: "m1", name: "Elena Ruiz", detail: "Product design", avatarUrl: face(24) },
  { id: "m2", name: "Milo Park", detail: "iOS engineering", avatarUrl: face(15) },
  { id: "m3", name: "Sofia Kim", detail: "Brand systems", avatarUrl: face(45) },
  { id: "m4", name: "Jonah Wells", detail: "Ops", avatarUrl: face(53) },
  { id: "m5", name: "Priya Nair", detail: "Content", avatarUrl: face(41) },
  { id: "m6", name: "Camila Ortiz", detail: "Photography", avatarUrl: face(28) },
];

/** Create group — name the group, pick members, create. */
export function CreateGroupScreen({
  contacts = DEFAULT_CONTACTS,
  onCreate,
  onBack,
}: CreateGroupScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [name, setName] = React.useState("Design crit");
  const [picked, setPicked] = React.useState<Set<string>>(new Set(["m1", "m3"]));
  const [query, setQuery] = React.useState("");

  const q = query.trim().toLowerCase();
  const shown = q
    ? contacts.filter(
        (c) => c.name.toLowerCase().includes(q) || c.detail.toLowerCase().includes(q)
      )
    : contacts;
  const pickedList = contacts.filter((c) => picked.has(c.id));

  const toggle = (id: string) => {
    haptics.selection();
    setPicked((p) => {
      const next = new Set(p);
      if (next.has(id)) next.delete(id);
      else next.add(id);
      return next;
    });
  };

  const ready = picked.size > 0 && name.trim().length > 0;

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <Mount className="gap-3 px-4 pb-3" style={{ paddingTop: insets.top + 64 }}>
        <View className="flex-row items-center gap-3">
          {/* Group photo — WhatsApp's camera tile next to the name field. */}
          <View className="h-12 w-12 items-center justify-center overflow-hidden rounded-full bg-[#BEF04C]">
            <Glass interactive effect="clear" sheen={0.5} className="absolute inset-0 rounded-full" pointerEvents="none" />
            <Icon name="camera" size="sm" color="#1B1B26" />
          </View>
          <View className="flex-1">
            <Input
              value={name}
              onChangeText={setName}
              placeholder="Group name"
              accessibilityLabel="Group name"
              glass
            />
          </View>
        </View>
        {/* Picked-member rail — WhatsApp idiom: avatars + remove X give
            instant feedback beyond a bare count. */}
        {pickedList.length > 0 && (
          <ScrollView
            horizontal
            showsHorizontalScrollIndicator={false}
            keyboardShouldPersistTaps="handled"
            contentContainerStyle={{ gap: 12 }}
          >
            {pickedList.map((c) => (
              <View key={c.id} className="w-12 items-center gap-1">
                <View>
                  <Avatar
                    size="md"
                    source={c.avatarUrl ? { uri: c.avatarUrl } : undefined}
                    fallback={c.name}
                    alt={c.name}
                  />
                  <Press
                    onPress={() => toggle(c.id)}
                    accessibilityRole="button"
                    accessibilityLabel={`Remove ${c.name}`}
                    className="absolute -right-1 -top-1 h-4.5 w-4.5 items-center justify-center rounded-full bg-foreground"
                    hitSlop={6}
                  >
                    <Icon name="x" size="sm" color="background" />
                  </Press>
                </View>
                <Text className="w-12 text-center text-[10px] text-muted-foreground" numberOfLines={1}>
                  {c.name.split(" ")[0]}
                </Text>
              </View>
            ))}
          </ScrollView>
        )}
        <SearchInput
          value={query}
          onChangeText={setQuery}
          placeholder="Search contacts"
          accessibilityLabel="Search contacts"
          glass
        />
      </Mount>

      {/* Selected-count header — like iOS picker rows, the count is the feedback. */}
      <Mount delay={60} className="flex-row items-center justify-between px-4 pb-1">
        <Text variant="small" className="text-muted-foreground">
          {picked.size === 0 ? "Select members" : "Members"}
        </Text>
        <View className="rounded-full bg-[#BEF04C] px-2.5 py-1">
          <Text className="text-xs font-bold text-[#1B1B26]">
            {picked.size} selected
          </Text>
        </View>
      </Mount>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{ paddingBottom: insets.bottom + 96 }}
      >
        <Mount delay={100}>
        <List inset glass>
          <List.Section>
            {shown.map((c, ii) => {
              const on = picked.has(c.id);
              return (
                <React.Fragment key={c.id}>
                  {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                  <List.Item
                    title={c.name}
                    subtitle={c.detail}
                    leading={
                      <Avatar
                        size="md"
                        source={c.avatarUrl ? { uri: c.avatarUrl } : undefined}
                        fallback={c.name}
                        alt={c.name}
                      />
                    }
                    trailing={
                      <View
                        className={`h-6 w-6 items-center justify-center rounded-full border ${
                          on
                            ? "border-[#BEF04C] bg-[#BEF04C]"
                            : "border-[#C9C9D4] bg-transparent"
                        }`}
                      >
                        {on && (
                          <Icon name="check" size="sm" color="#1B1B26" />
                        )}
                      </View>
                    }
                    haptic="selection"
                    onPress={() => toggle(c.id)}
                    accessibilityState={{ selected: on }}
                    className="py-2.5"
                  />
                </React.Fragment>
              );
            })}
          </List.Section>
        </List>
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <Button
          haptic="light"
          disabled={!ready}
          onPress={() => {
            haptics.medium();
            onCreate?.(name.trim(), Array.from(picked));
          }}
          accessibilityLabel={`Create group with ${picked.size} members`}
          className="w-full bg-[#BEF04C]"
          textClassName="text-[#1B1B26]"
        >
          {picked.size > 0 ? `Create group · ${picked.size}` : "Create group"}
        </Button>
      </StickyBottomBar>

      {/* Floating chrome — back pill + hug-label title pill. */}
      <View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
        <View className="flex-row items-center gap-2">
          <Glass
            effect="regular"
            className="h-11 w-11 items-center justify-center rounded-full"
          >
            <Button
              variant="ghost"
              size="icon"
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityLabel="Go back"
              className="h-9 w-9"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Button>
          </Glass>
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <Glass
            effect="regular"
            className="h-11 flex-row items-center justify-center rounded-full px-5"
          >
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              New group
            </Text>
          </Glass>
        </View>
      </View>
    </SafeAreaView>
  );
}
CreateGroupScreen.displayName = "CreateGroupScreen";
```

Screen: https://lumioui.dev/screens/chat-create-group
iPhone 17 · iOS
9:41
Live preview — the real screen via Expo Web · open full ↗