Click on the folder to close or collapse.

library(dir)
# default path is current directory
listing(height = "120px")

You can specify the path to show along with the depth of the files/folders to show:

listing(path = "../inst", recurse = 3, height = "250px")