AFK Player
AFK Player is a free open-source datapack for Minecraft version 1.14 and higher that allows identifying whether a player is in AFK (Away From Keyboard) mode next to their name.
This special status will be automatically displayed next to every nickname in any game interface - whether it's the player list in the sidebar or any other menu.
If a player remains inactive for a sufficient period of time (doesn't move or perform any actions for 2 minutes 30 seconds - 5 minutes), the system will automatically include them in the special AFK team. The [AFK] attribute will be added next to their in-game name, as shown in the image above.
As soon as the user becomes active again - moves, performs any action, or starts moving - they will be immediately removed from the AFK team, and the corresponding status will automatically disappear from their nickname.
Important clarification: this datapack does not support manual commands like /afk to indicate one's status - the entire process is fully automated and does not require user intervention.