Reputation: 33
I want to change the button text from 'Publish Changes' into 'Publish Data' in the Payload CMS but can't find any file where it contain the button style that i can edit
is anyone know how to change the button name? Thank you
Upvotes: 1
Views: 743
Reputation: 1
Today, I had a similar problem. I want to add this because documentation sometimes is not enaugh :). If you want to change text in "Publish Changes" button you must:
components: {
edit: {
PublishButton: CustomPublishButton, // Your custom publish button
// You can also define other custom buttons if needed
},
},
import { CustomPublishButton } from '../../components/CustomPublishButton'
import React from 'react'
export const CustomPublishButton = props => {
const { DefaultButton, ...rest } = props
return <DefaultButton {...rest} draft={true} label="Save & Publish" />
}
Execute this two commands in console.
yarn payload generate:graphQLSchema
yarn generate:types
Done
If you want to change only css styles do this bellow:
Check the CSS class name of the item (using the developer console in your web browser).
Add the appropriate class inside the /src/css/admin.css file. For example:
.form-submit {
.btn__label {
font-size: 32px;
}
}
Upvotes: 0
Reputation: 2999
You would need to swap in a new react component in order to override the text.
The documentation for swapping out collection components is here: https://payloadcms.com/docs/admin/components#collections. You would specifically swap out the PublishButton
.
You can also find the default publish button to modify here: https://github.com/payloadcms/payload/blob/main/packages/payload/src/admin/components/elements/Publish/index.tsx
Upvotes: 0