Yes, you read that right. It's not supposed a tech gadget, of course, but a magical item. A sword hilt that can be turned on by an attuned character (or whoever is holding it?) to create blade of solid light just as we know it. The exact optics may vary.
The base spell for this would obviously have to be researched (i.e., made up), but what existing spell list should this spell be added to? I cannot find any spell that would fit it at least remotely. Level of the spell may vary depending on damage.
I see it as a Constant enchantment, cast twice per day to make this thing able to be switched on and off. Standard rules apply, right?