
From Kiosk projects to homelab dashboards, there are numerous usage of a touch screen display with Raspberry Pi.
And it makes total sense to use the on-screen keyboard on the touch device rather than plugging in a keyboard and mouse.
Thankfully, the latest versions of Raspberry Pi OS provide a simple way to install and use the on-screen keyboard.

Let me show how you can install the on-screen keyboard support on Raspberry Pi OS.

Partner Link
Just check if you already have the on-screen keyboard support
Raspberry Pi OS Bookworm and later versions include the Squeekboard software for the on-screen keyboard feature.
Now, this package may already be installed by default. If you open a terminal and touch the interface and it brings the keyboard, you have everything set already.
It is also possible that it is installed but not enabled.
Go to the menu, then Preferences and open Raspberry Pi config tool. In the display tab, see if you can change the settings for the on-screen keyboard.

If you tap the on-screen keyboard settings and it says, "A virtual keyboard is not installed", you will have to install the software first. The next section details the steps.

Getting on-screen keyboard in Raspberry Pi OS Bookworm
Update the package cache of your Raspberry Pi first:
sudo apt update
The squeekboard
package provides the virtual keyboard in Debian. Install it using the command below:
sudo apt install squeekboard
Once installed, click on the menu and start Raspberry Pi Configuration from the Preferences.

In the Raspberry Pi Configuration tool, go to the Display tab and touch it.

You'll see three options:
- Enabled always: The on-screen keyboard will be always accessible through the top panel, whether you are using touchscreen or not.
- Enabled if touchscreen found: The on-screen keyboard is only accessible when it detects a touchscreen.
- Disabled: Virtual keyboard won't be accessible at all.
Out of these three, you'll be tempted to go for the 'Enabled if touchscreen found'.
However, it didn't work for me. I opted for Enabled always instead.
But not all applications will automatically bring up the on-screen keyboard. In my case, Chromium didn't play well. Thankfully, the on-screen keyboard icon at top panel lets you access it at will.

And this way, you can enjoy the keyboard on a touchscreen.
Conclusion
For older versions of Raspberry Pi OS, you could also go with the matchbox-keyboard
package.
sudo apt install matchbox-keyboard
Since Squeekboard is for Wayland, perhaps Matchbox will work on Xorg display server.
The official documents of SunFounder's Touchscreen mentions that Squeekboard is installed by default in Raspberry Pi OS but that was not the case for me.
Installing it was matter of one command and then the virtual keyboard was up and running. This is tested on Raspberry Pi OS but since Squeekboard is available for Wayland in general, it might work on other operating systems, too.
π¬ Did it work for you? If yes, a simple 'thank you' will encourage me. If not, please provide the details and I'll try to help you.