Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Header/Footer slots #637

Closed
5 tasks done
ericclemmons opened this issue Nov 5, 2021 · 1 comment
Closed
5 tasks done

Custom Header/Footer slots #637

ericclemmons opened this issue Nov 5, 2021 · 1 comment
Labels
Angular An issue or a feature-request for Angular platform Documentation An issue or a feature-request for our Amplify UI Doc site or AWS Amplify docs feature-request Request a new feature React An issue or a feature-request for React platform Vue An issue or a feature-request for Vue platform

Comments

@ericclemmons
Copy link
Contributor

ericclemmons commented Nov 5, 2021

Closes #259, #498, #257

Customizing text via I18n isn't enough. Slots are needed to prepend, append, & replace entire elements.


These largely exist in the internal implementation, but need to be exposed & documented.

Slot Names (React)

Here I mocked up the React documentation with where the slots would go:

Screen Shot 2021-11-05 at 10 38 03 AM
Screen Shot 2021-11-05 at 10 43 51 AM
Screen Shot 2021-11-05 at 10 44 14 AM

Slot Implementation (React)

This example implementation does the following:

  • Adds a Logo above the entire Authenticator in the Header
  • Adds a legal text below the entire Authenticator in the Footer
  • Appends the SignIn.Header with a subtitle
  • Injects a custom SignIn.Footer below the form
const customComponents = {
  Header() {
    return <img src="logo.png" />
  },
  Footer() {
    return <p>Copyright 2021</p>
  },
  SignIn: {
    Header() {
  	  return (
		<>
		  <Authenticator.SignIn.Header />
		  <h3>Internal Use Only!</h3>
		</>
	  )
    },
    Footer() {
      return <p>Call 1-800-help-desk for support</p>
    }
  }
}

function App() {
  return (
    <Authenticator components={customComponents}>
	  {({ user }) => <h1>Howdy {user.username}</h1>}
	</Authenticator>
  )
}
@ericclemmons ericclemmons added Documentation An issue or a feature-request for our Amplify UI Doc site or AWS Amplify docs feature-request Request a new feature Angular An issue or a feature-request for Angular platform Vue An issue or a feature-request for Vue platform React An issue or a feature-request for React platform labels Nov 5, 2021
@ericclemmons ericclemmons mentioned this issue Nov 12, 2021
12 tasks
@ericclemmons
Copy link
Contributor Author

Closed via #695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Angular An issue or a feature-request for Angular platform Documentation An issue or a feature-request for our Amplify UI Doc site or AWS Amplify docs feature-request Request a new feature React An issue or a feature-request for React platform Vue An issue or a feature-request for Vue platform
Projects
None yet
Development

No branches or pull requests

1 participant