Skip to content

Components API Reference ​

Complete reference for all components available in Flowfull Client packages.

BridgeView ​

Conditional rendering based on authentication and user type.

Available in: @pubflow/react, @pubflow/react-native, @pubflow/nextjs

Props ​

typescript
interface BridgeViewProps {
  children: React.ReactNode;
  allowedTypes?: string | string[];
  fallback?: React.ReactNode;
  loadingComponent?: React.ReactNode;
  onUnauthorized?: () => void;
  instanceId?: string;
}
PropTypeDescription
childrenReact.ReactNodeContent to render when authorized
allowedTypesstring | string[] (optional)Allowed user types
fallbackReact.ReactNode (optional)Content to render when unauthorized
loadingComponentReact.ReactNode (optional)Loading state component
onUnauthorized() => void (optional)Callback when unauthorized
instanceIdstring (optional)Pubflow instance ID

Example ​

typescript
import { BridgeView } from '@pubflow/react';

function AdminPanel() {
  return (
    <BridgeView
      allowedTypes={['admin', 'superadmin']}
      fallback={<div>Access Denied</div>}
      loadingComponent={<div>Loading...</div>}
    >
      <div>Admin Content</div>
    </BridgeView>
  );
}

BridgeForm ​

Form component with automatic submission and validation.

Available in: @pubflow/react, @pubflow/react-native, @pubflow/nextjs

Props ​

typescript
interface BridgeFormProps {
  endpoint: string;
  method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
  onSuccess?: (data: any) => void;
  onError?: (error: Error) => void;
  children: React.ReactNode;
  instanceId?: string;
}
PropTypeDescription
endpointstringAPI endpoint
method'POST' | 'PUT' | 'PATCH' | 'DELETE'HTTP method
onSuccess(data: any) => void (optional)Success callback
onError(error: Error) => void (optional)Error callback
childrenReact.ReactNodeForm fields
instanceIdstring (optional)Pubflow instance ID

Example ​

typescript
import { BridgeForm } from '@pubflow/react';

function CreateUserForm() {
  return (
    <BridgeForm
      endpoint="/api/users"
      method="POST"
      onSuccess={(data) => console.log('Created:', data)}
      onError={(error) => console.error('Error:', error)}
    >
      <input name="name" placeholder="Name" required />
      <input name="email" type="email" placeholder="Email" required />
      <button type="submit">Create</button>
    </BridgeForm>
  );
}

BridgeTable ​

Table component with automatic data fetching and pagination.

Available in: @pubflow/react, @pubflow/nextjs

Props ​

typescript
interface BridgeTableProps<T> {
  endpoint: string;
  columns: ColumnDef<T>[];
  pageSize?: number;
  onRowClick?: (row: T) => void;
  instanceId?: string;
}

interface ColumnDef<T> {
  key: keyof T;
  header: string;
  render?: (value: any, row: T) => React.ReactNode;
}
PropTypeDescription
endpointstringAPI endpoint
columnsColumnDef<T>[]Column definitions
pageSizenumber (optional)Items per page (default: 10)
onRowClick(row: T) => void (optional)Row click handler
instanceIdstring (optional)Pubflow instance ID

Example ​

typescript
import { BridgeTable } from '@pubflow/react';

interface User {
  id: string;
  name: string;
  email: string;
}

function UserTable() {
  return (
    <BridgeTable<User>
      endpoint="users"
      columns={[
        { key: 'name', header: 'Name' },
        { key: 'email', header: 'Email' },
        {
          key: 'id',
          header: 'Actions',
          render: (id) => <button>Edit</button>
        }
      ]}
      pageSize={20}
      onRowClick={(user) => console.log('Clicked:', user)}
    />
  );
}

BridgeList ​

List component for React Native with pull-to-refresh and infinite scroll.

Available in: @pubflow/react-native

Props ​

typescript
interface BridgeListProps<T> {
  endpoint: string;
  renderItem: (item: T) => React.ReactNode;
  keyExtractor?: (item: T) => string;
  pageSize?: number;
  onItemPress?: (item: T) => void;
  instanceId?: string;
}
PropTypeDescription
endpointstringAPI endpoint
renderItem(item: T) => React.ReactNodeItem renderer
keyExtractor(item: T) => string (optional)Key extractor
pageSizenumber (optional)Items per page
onItemPress(item: T) => void (optional)Item press handler
instanceIdstring (optional)Pubflow instance ID

Example ​

typescript
import { BridgeList } from '@pubflow/react-native';
import { Text, TouchableOpacity } from 'react-native';

function UserList() {
  return (
    <BridgeList
      endpoint="users"
      renderItem={(user) => (
        <TouchableOpacity>
          <Text>{user.name}</Text>
          <Text>{user.email}</Text>
        </TouchableOpacity>
      )}
      keyExtractor={(user) => user.id}
      pageSize={20}
    />
  );
}

OfflineIndicator ​

Shows network status indicator (React Native only).

Available in: @pubflow/react-native

Example ​

typescript
import { OfflineIndicator } from '@pubflow/react-native';

function App() {
  return (
    <>
      <OfflineIndicator />
      <YourApp />
    </>
  );
}

Next Steps ​