keystatic icon indicating copy to clipboard operation
keystatic copied to clipboard

Slug field: option to make field readonly

Open JohannaPeanut opened this issue 1 year ago • 4 comments

Hi We like to work with the slug field to have automatic slug generation. However, we have found that in certain cases (especially with collections, and when it comes to relations) it would be very useful to have the option to use the slug field as a read-only field. Thank you :)

JohannaPeanut avatar Jul 04 '24 09:07 JohannaPeanut

For example something like a readonly:boolean property

slug?: {
  label?: string;
  generate?: (name: string) => string;
  description?: string;
+   readonly?: boolean;
  validation?: {
    length?: {
      min?: number;
      max?: number;
    };
  };
};

tordans avatar Jul 04 '24 12:07 tordans

Would love to see this soon. In my case, I have a text field (could also be a select, I suppose) that needs to be a specific value. I'd like to set this in the config and then either have it "readonly" or "hidden" in the UI for my client. It needs to be present each time a new entry is created.

cpenned avatar Jan 18 '25 23:01 cpenned

I should mention, for now, I've just created a select field with only one entry. But having this enhancement would allow me to simplify and reuse my config.

cpenned avatar Jan 18 '25 23:01 cpenned

Would like to see this. Pretty important. Gotta be a way to simply disable the field in the interface based on this type of suggested boolean? Wonder if anyone has some JS ideas

cp-bwg avatar Apr 06 '25 14:04 cp-bwg