Multiple Buttons To Use One Text Input Field

Is it possible for me to use multiple buttons to use one text input field to name each button?
Something like say I have a grid of buttons and I click one button that will set a public bool to true or false, first click = true
2nd click = false
but if it’s true that I can access the text input field to name that button save that name to player prefs and then turn on my 2nd button and name it and so on?

I have a text input field set up next to my grid of buttons but not sure how to go about setting up the text input field to save each button name?
I have set up a script with the following bools and button calls.

//Space Matt Button Bools
	public bool sMatt01 = false;
	public bool sMatt02 = false;
	public bool sMatt03 = false;

//Button State Settings
	private int sM01;
	private int sM02;

void Awake (){
		//Space Matt Button 01
		sM01 = PlayerPrefs.GetInt ("spaceMatt01");
		if (sM01 == 1) {
			sMatt01 = true;
		} else {
			sMatt01 = false;
		//Space Matt Button 02
		sM02 = PlayerPrefs.GetInt ("spaceMatt02");
		if (sM02 == 1) {
			sMatt02 = true;
		} else {
			sMatt02 = false;

//Space Matt Buttons Grid
	public void spaceMatt01OnOff(){ //Space Matt Button 01
		sMatt01 = ! sMatt01;
		if (sMatt01 == false) {
			PlayerPrefs.SetInt ("spaceMatt01", 0);
		} else {
			sMatt01 = true;
			PlayerPrefs.SetInt ("spaceMatt01", 1);
	public void spaceMatt02OnOff(){ //Space Matt Button 02
		sMatt02 = ! sMatt02;
		if (sMatt02 == false) {
			PlayerPrefs.SetInt ("spaceMatt02", 0);
		} else {
			sMatt02 = true;
			PlayerPrefs.SetInt ("spaceMatt02", 1);

To better help illustrate what I’m wanting to do I have attached the following image of my UI

Yes. You need to store the active index and update the display to respond.

When a user presses a button, switch to the index of that button. When disabled, use something like -1 to indicate nothing is active.

When the index changes, pull the appropriate text for that index and load it into the textfield.

When the text is changed and the index is valid, store the value of the textfield to your data.

That should get you started. Let me know if anything is unclear.