Home / Function/ slugField() — supabase Function Reference

slugField() — supabase Function Reference

Architecture documentation for the slugField() function in index.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  3a9897cc_27d2_4cbf_1716_788bb4d603b2["slugField()"]
  27585975_96f1_a469_bb0c_d69231112b6a["formatSlugHook()"]
  3a9897cc_27d2_4cbf_1716_788bb4d603b2 -->|calls| 27585975_96f1_a469_bb0c_d69231112b6a
  style 3a9897cc_27d2_4cbf_1716_788bb4d603b2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/cms/src/fields/slug/index.ts lines 12–53

export const slugField: Slug = (fieldToUse = 'title', overrides = {}) => {
  const { slugOverrides, checkboxOverrides } = overrides

  const checkBoxField: CheckboxField = {
    name: 'slugLock',
    type: 'checkbox',
    defaultValue: true,
    admin: {
      hidden: true,
      position: 'sidebar',
    },
    ...checkboxOverrides,
  }

  // @ts-expect-error - ts mismatch Partial<TextField> with TextField
  const slugField: TextField = {
    name: 'slug',
    type: 'text',
    index: true,
    label: 'Slug',
    ...(slugOverrides || {}),
    hooks: {
      // Kept this in for hook or API based updates
      beforeValidate: [formatSlugHook(fieldToUse)],
    },
    admin: {
      // position: 'sidebar',
      ...(slugOverrides?.admin || {}),
      components: {
        Field: {
          path: '@/fields/slug/SlugComponent#SlugComponent',
          clientProps: {
            fieldToUse,
            checkboxFieldPath: checkBoxField.name,
          },
        },
      },
    },
  }

  return [slugField, checkBoxField]
}

Subdomains

Frequently Asked Questions

What does slugField() do?
slugField() is a function in the supabase codebase.
What does slugField() call?
slugField() calls 1 function(s): formatSlugHook.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free